Is the StackPanel.Visibility property not working as expected?
Imagine I am holding the below code on a button click:
if(condition==true)
{
Panel1.Visibility = Visibility.Visible;
Panel.Visibility = Visibility.Collapsed;
}
else
{
Panel.Visibility = Visibility.Visible;
Panel1.Visibility = Visibility.Collapsed;
}
Works for the first time and then one of the panels collapses, but the other panel does not become visible.
Any ideas why this is happening?
0
Raja
a source
to share
2 answers
It may be that the parent of the control panel Panel and Panel1 does not resize when its visibility changes. Try to put Panel and Panel1 on a grid that has 2 lines, each line has its own height set to Auto. I have had success with this hierarchy in the past. If that doesn't work, can you post the complete and simplest Xaml that will play?
0
a source to share