XAML how to call GUI
How can I call the UI for an 开发者_开发知识库XAML from another class please?
Thanks.
:)
If the XAML is a Window, instantiate the XAML class and call Show().
<Window x:Class="MyWindow"... >
...
</Window>
MyWindow w = new MyWindow();
w.Show();
You can use the x:FieldModifier XAML attribute to make a control public or internal like you would in Windows Forms but this is frowned upon. You should instead either create properties in your code-behind class or you should look into separated presentation patterns such as MVVM which encourage little to no direct manipulation of the UI.
精彩评论