显示从主窗口调用的用户控件 [英] show user control called from main window

查看:74
本文介绍了显示从主窗口调用的用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我正在使用WPF UserControl,我是第一次在WPF窗口之后使用UserControl。我创建了WPF应用程序,它有一个叫做MainWindow的窗口.MAinWindow有一个叫做''技术'的Button。我还创建了名为''TechnologyUserControl''的UserControl。我想点击按钮''Technology'后显示''TechnologyUserControl''。



我试过TechnologyUserControl.Visibility = System.Windows.Visibility.Visible;

其中,TechnologyUserControl是UserControl的实例......



任何人都可以帮助我..谢谢..

lately i''m working on WPF UserControl,i''m kind first time using UserControl after WPF window. I have created WPF Application, it has Window called "MainWindow".MAinWindow have Button named ''Technology''. I have also created UserControl named ''TechnologyUserControl''.I want to show ''TechnologyUserControl'' after clicking on button ''Technology''.

I have tried "TechnologyUserControl.Visibility = System.Windows.Visibility.Visible;"
where TechnologyUserControl is instance of UserControl...

Can anybody help me .. Thanks..

推荐答案





如果您正在按照以下流程告诉我,



1)创建用户控件对象的实例。

2)在页面上的父现有控件之一中添加控制对象(例如,在某些面板内)



如果你按照上面的两个过程然后你的控件应该显示。您不需要设置usercontrol的可见性。只有在你隐藏控制权时才需要能见度。



谢谢

-Amit
Hi,

Let me know if you are following below process,

1) Create instance of User control object.
2) Add control object in one of the parent existing control on the page(ex. inside some panel)

if you follow above two process then your control should display. you do not need to set visibility of your usercontrol. visibility is required only when you are hiding control.

Thanks
-Amit


这篇关于显示从主窗口调用的用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆