c# - How to change the visible property of the text box from the view model ( WPF, MVVM) -


I am starting with WPF and MVVM. I have some control over a window in my project, for example, my There is a text box in my window near me. I am using the MVVM pattern and here I want to change the visual property of the text box with visual model. Another thing is, I want to change the visibility of the text box with the view modal based on some circumstances.

Well, I forgot it and Google gave me some suggestions, which were all different solutions and I 'm in total confusion

can anyone help me understand this is.

I know that this WPF will be a piece of cake for MVVM experts, but since I am trying to learn this material, then I need some code as an example.

Thanks

Since it is MVVM, you change the visibility of the textbox Do not want to actually disable want some options again .. - Whether that option is enabled or disabled, your textbox's visibility should be reflected on.

So basically you want a property in ViewModel like:

  Public Bull CanopyropertyBeCheng {Received; Set;}   

that you can change (of course you do not already have ...) ... and force visibility of the text box of this property Converter:

  & lt; Text box visibility = "{Binding CanMyPropertyBeChanged, converter = {StaticResource boolToVis}}" />   

You can use the built-in for it:

  & lt; BooleanToVisibilityConverter x: key = "boolToVis" />    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -