Hy guys please help. I'm working in WPF program. I have a grid named body_grid where I display my usercontrols in MainWindow.
My problem is that I can not switch between usercontrol in parent grid.
Eg usercontrolA is displayed in body_grid with button.
Now a usercontrolA button must remove usercontrolA in body_grid and display usercontrolB.
How can I do that please help
This can be implemented using Visibility property. If you are not using MVVM patern, code below shows a example of what you are trying to accomplish:
private void Button_Click(object sender, RoutedEventArgs e)
{
userControlB.Visibility = Visibility.Visible;
userControlA.Visibility = Visibility.Collapsed;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.