In my application, I've got a stackpanel I'd like to keep hidden (or collapsed, whatever keeps it out of sight until it's needed) and it is to be made visible when the user clicks a button.
The issue I've run into, using my rudimentary knowledge of the MVVM technique, is to have the stackpanel's visibility bound to a property in my viewmodel. The property is a Visibility type, and the button uses a custom command utilizing the ICommand interface to call the method in my viewmodel which, at this stage, simply alters the value of the visibility property to which the stackpanel is bound.
I've confirmed the command itself is successfully calling the method, and the visibility property IS being changed, but the stackpanel to which I have bound the visibility property refuses to become visible.
I'll try to construct an illustrative example of the code I'm using:
<Button Content="Show StackPanel" Command="{Binding Path=ShowPanelCommand}" />
<StackPanel Visibility="{Binding Path=panelVisibility}" />
And in the method called by the Command in the viewmodel:
public Visibility panelVisibility { get; set; }
public void ShowThePanel()
{
panelVisibility = Visibility.Visible;
}
I'm quite new to C#/.NET and programming in general.
I've learned a lot in a short amount of time, but once in a while I do hit a brick wall like this.
Some guided assistance would be invaluable to me.
I'm open to suggestions for better/more efficient techniques for achieving the result I've outlined in this question, but just the same for the benefit of my understanding I'd like to know what I missed or did wrong while trying to use this particular way.
Thanks for the help.