Reputation: 1807
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?
Upvotes: 0
Views: 186
Reputation: 16526
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.
Upvotes: 1
Reputation: 13972
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.
Upvotes: 1