0

I have an application which consist of one "MainWindow" and inside main i have called a user control "loginControl" like this;

<!-- Login user Control --> <local:LoginView x:Name="loginControl" HorizontalAlignment="Center" VerticalAlignment="Center" /> 

Now, inside the "loginControl" i have also three controls like this;

<local:ForgotPassword x:Name="userControlForgotPassword" Visibility="Collapsed" /> <local:CreateNewUser x:Name="userControlCreateNew" Visibility="Collapsed" /> <local:ChangePassword x:Name="userControlChangePassword" Visibility="Collapsed" /> 

and in code behind of "loginControl" i have called these events;

private void hyperLinkCreateNew_Click(object sender, RoutedEventArgs e) { userControlCreateNew.Visibility = System.Windows.Visibility.Visible; } private void hyperForgotPassword_Click(object sender, RoutedEventArgs e) { userControlForgotPassword.Visibility = System.Windows.Visibility.Visible; } private void hyperLinkChangePassword_Click(object sender, RoutedEventArgs e) { userControlChangePassword.Visibility = System.Windows.Visibility.Visible; } 

Now, what i want is that, when i click on "create New" ( which is a link in 'loginControl' and change the visibility of "create new usr control"). The "loginControl" window should be disappered by using custom events. How could i do that?. Thanks in advance.

1 Answer 1

1
private void hyperLinkCreateNew_Click(object sender, RoutedEventArgs e) { userControlCreateNew.Visibility = System.Windows.Visibility.Visible; Window parent = Window.GetWindow(this); LoginView loginView = (LoginView)(parent.FindName("loginControl")); loginView.Visibility = System.Windows.Visibility.Hidden; } 
Sign up to request clarification or add additional context in comments.

2 Comments

As i click on hyperLinkCreateNew, this code hides the loginControl but the userControlCreateNew isn't showing up. If the parent is hidden, the children also hides with it (becuase child controls are also in parent).
As you said: "...when i click on 'create New'. The "loginControl" window should be disappered by using custom events."

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.