elisa
Topic Author
Posts: 3
Joined: 01 Feb 2015, 05:32

load another XAML fragment or XAML file?

01 Feb 2015, 05:47

How do you load another XAML or a XAML fragment on-top of an existing XAML file?


1) I have an existing UI.
i want to popup a dialog box. How do I do that?

2) I have an existing UI.
I want to switch to render another XAML file. How do i do that?
 
User avatar
Scherub
Posts: 141
Joined: 06 May 2014, 20:53
Contact:

Re: load another XAML fragment or XAML file?

02 Feb 2015, 15:16

1. Either you have it already defined in XAML and just switch the visibility or you load it at runtime in code: NoesisGUISystem.LoadXaml()

2. There are again several possibilities. The first two that come to my mind are:

- You could load them all and just switch the visibility depending on what you want to see.
- You could have a ContentPresenter where you set the content to what you want to see.

PS: You should use the search function of this forum as various questions were already asked and you wouldn't have to wait for someone to answer. :)
 
User avatar
sfernandez
Site Admin
Posts: 1918
Joined: 22 Dec 2011, 19:20

Re: load another XAML fragment or XAML file?

03 Feb 2015, 18:30

Thanks for helping here Scherub ;)

As he explained it all depends on what you want to accomplish, but the basic bits are:
  • NoesisGUISystem.LoadXaml() can be used to load a xaml file from your Unity project.
  • If you created your own UserControl you can even call: new MyUserControl(), to load its associated xaml and add it to current UI.
  • You usually have a MainWindow.xaml attached to the camera that covers the entire screen. That xaml is used as root container to host and transition between all the UI panels you load and want to show in your game. You can take a look at our ControlGallery sample to learn how to make a cool transition between 2 xamls.

Who is online

Users browsing this forum: Google [Bot] and 0 guests