Click here to Skip to main content
15,888,330 members

Comments by Marvin Ma (Top 40 by date)

Marvin Ma 30-Oct-13 5:36am View    
Define a property which handles the visibilities (e.g. UserControlVisibility) and BIND this to the visibility property of your user control.

You have to use the BoolToVisibilityConverter.

The property you created (UserControlVisbility) will be set if you select an item of your list (in your case the name).
Make sure to switch the visibility when no name is selected (have a look at selected item).

Now, try to write this logic...I could to this for you, but this would not have any learning effect to you.

Remember: Learning by doing!
Marvin Ma 30-Oct-13 3:39am View    
The fact that you are using a user control allows you to use the routed event of the list box, because you do not produce code behind in your view.
You handle the code within your user control.

Same is valid for a custom control.
Marvin Ma 29-Oct-13 10:22am View    
Yeah, sorry wanted to edit that, but you have been faster.

The list box has the events you are looking for:

SelectionChanged for example.
If the event got fired, just set the visibility, this is not the 'cleanest' way, but If you are new to MVVM, this would be the first step.
Marvin Ma 29-Oct-13 10:12am View    
You could define a property to handle the visibilities.
Also define a command or routed event to handle the button click, which sets the property to the value you want.

Try for yourself, it's simple.
If you need help, just ask.
Marvin Ma 29-Oct-13 6:26am View    
Edited my solution.