views:

352

answers:

2

Imagine i keep the below code in 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 panel collapses but the other panel doesnt become visible...

any ideas why this is happening ?

A: 

Could be that the parent of the controls Panel and Panel1 isn't resizing itself when you modify their Visibility. Try putting Panel and Panel1 in a Grid that has 2 rows, each row having its Height set to Auto. I've had success with that hierarchy in the past. If that doesn't work could you post the complete and simplest Xaml that will repro?

James Cadd
A: 

Actually the panels had height set to them when i removed it worked... anyway thanks for answerers