private void LogOut() { UserControlHome ucObj = new UserControlHome(); IntPtr windowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle; MainWindow window = (MainWindow)HwndSource.FromHwnd(windowHandle).RootVisual; window.GridHome.Children.Add(ucObj); window.ButtonAccount.Visibility = Visibility.Hidden; window.GridShoppingCart.Visibility = Visibility.Hidden; window.UserNameTextBox.Visibility = Visibility.Hidden; window.ButtonLogout.Visibility = Visibility.Hidden; window.ButtonLogin.Visibility = Visibility.Visible; window.ButtonRegister.Visibility = Visibility.Visible; }
private void ButtonHome_Click(object sender, RoutedEventArgs e) { UserControlHome ucObject = new UserControlHome(); GridHome.Children.Add(ucObject); }