tags:

views:

40

answers:

2

Hi all,

I have a wpf application that has a number of user controls defined. For one of these controls (a login screen) I want to be able to hide the login user control and then display the registration user control. In the code behind file for the login I have tried the following

Registration reg = new Registration();
reg.Visibility = Visibility.Visible;

Is there a way to do this? I have also read about a page object in reading upon wpf - is this a better way to go about this problem?

+1  A: 

You've created it, but you haven't added it.

You need to add it to the parent UserControl or Window you want it displayed in.

McAden
For example you might have a StackPanel called RegistrationPanel and then you'd: RegistrationPanel.Content = reg;
TimothyP
A: 

You could create both controls in a Grid or DockPanel or similar using XAML, and then set Visibility = Visibility.Collapsed to hide the individual controls.

Groky