i am new to WPF, need a help...
i have parent window with stackpanel in that, i placed grid with button and usercontrol.
i am loading usercontrol when button link on the same stackpanel and after click on back i need to show the eariler grid in stack panel. can any one provide some solution for this please.
Loading
Afzaal Ahmad ZeeshanPosted Feb 5, 2015, 10:51 AM
void Button_Click(object sender, EventArgs e) {
// this is the code block for handling the event
}
Inside the block, you can use the logic to show the previous Grid. In WPF you can easily name your controls, suppose you're having two controls for Grid, and you name them like Grid1 and Grid2. Inside that button click event you can change their Visibility property, to display either one depending on your logic. For example, if you want to display Grid1, you would write this code,
// View Grid1
Grid1.Visibility = Visibility.Visible;
// Hide Grid2
Grid2.Visibility = Visibility.Collapsed;
This would do your job for you. You can read the MSDN document for the Visibility property of the controls.