开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜