Long stall when loading XAML
We're running into a problem while loading some of our custom UserControl classes. Each of our menu pages is a subclass of Noesis::UserControl, usually Noesis::Page. When the user wants to open a menu, we load it from the source XAML and add it to a parent element to be displayed. When the user closes the menu, we remove it from the parent element and destroy the object.
Loading and parsing the XAML, then loading the Components causes a very long stall, sometimes multiple seconds, before the UI is fully loaded and the game is able to continue.
I wrote a snippet below to illustrate the process we use:
We did some profiling and the following stood out:
Is there anything you can recommend? Thanks in advance!
Loading and parsing the XAML, then loading the Components causes a very long stall, sometimes multiple seconds, before the UI is fully loaded and the game is able to continue.
I wrote a snippet below to illustrate the process we use:
Code: Select all
Noesis::Canvas* canvas; // This is what we use as the parent element for our menus
Noesis::Uri uri = /* Retrieve our URI from our lookup table */;
MyCustomUserControl* control = Noesis::GUI::LoadXaml<MyCustomUserControl>(uri);
control->LoadComponent(uri);
canvas->GetChildren()->Add((Noesis::UIElement *)control);- Noesis::ViewLayout::ProcessLayout takes up a lot of time when we do this. It seems to be doing a lot of measuring (possibly having to recalculate the positions of all the UI elements?)
- canvas->GetChildren()->Add(...) in the above example also takes a lot of time, it seems to kick off a lot of initialization logic in all the sub-objects
Is there anything you can recommend? Thanks in advance!
Re: Long stall when loading XAML
I’m pretty sure the parsing is not causing the stall.
Do these UserControls contain merged dictionaries? We recommend moving as many templates, styles, and resources as possible to the global dictionary.
Could that be the cause of the problem?
Do these UserControls contain merged dictionaries? We recommend moving as many templates, styles, and resources as possible to the global dictionary.
Could that be the cause of the problem?
Re: Long stall when loading XAML
May have been a false alarm, was due to a setup on our end. Seems to work OK in our release builds.I’m pretty sure the parsing is not causing the stall.
Do these UserControls contain merged dictionaries? We recommend moving as many templates, styles, and resources as possible to the global dictionary.
Could that be the cause of the problem?
Re: Long stall when loading XAML
Thanks for the feedback! Please keep us posted.
Who is online
Users browsing this forum: No registered users and 6 guests