tags:

views:

38

answers:

2

Hi, How can I call the UI for an XAML from another class please?

Thanks.

:)

A: 

If the XAML is a Window, instantiate the XAML class and call Show().

<Window x:Class="MyWindow"... >
...
</Window>

MyWindow w = new MyWindow();
w.Show();
Timores
A: 

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.

Josh Einstein