我如何从不同于主窗口的类中访问xaml中的控件 [英] How do I..access a control in xaml from a class different from the mainwindow
本文介绍了我如何从不同于主窗口的类中访问xaml中的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮助PLZ,
我正在尝试访问我创建的类中的数据网格控件。此控件在XAML文件中创建。或者我如何在运行时创建控件并将其放在dockpanel中。
请帮忙。我是新手或全新的。
MAJ
Can some one help plz,
I am trying to access a datagrid control in a class i create. this control is created in the XAML file. or how can i create the control at run time and put it inside a dockpanel.
kindly help. I am novice or brand new in this.
MAJ
推荐答案
Just Need to Follow Bellow Steps :-
1)Create a User Control.
-- it's same like Window.
2) then Use That User Control as Data Type.
-- it's same like Using your own controls.
这行代码怎么样:
Hi, what about this line of code:
your_dockpanel.Children.Add(your_user_control);
问候。
Regards.
这篇关于我如何从不同于主窗口的类中访问xaml中的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文