简体   繁体   中英

wpf user control

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?

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.

您可以使用XAML在Grid或DockPanel或类似控件中创建两个控件,然后将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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM