Forcing a XAML to load via a throw away renderer
Posted: 15 Oct 2014, 19:06
Hello,
So I am attempting to load a xaml dynamically with the following line:
However when I try to find the children or access any nodes under this element, I get a value of 0.
Once I add this to my main GUI tree like this:
and then call Noesis_Update I am able to traverse the new xaml tree. Now this works fine, but it will increase the complexity of my code since I make the update and children add calls at the top of my frame. To reduce this complexity a tried using a throw away renderer as follows based on (http://www.noesisengine.com/docs/Gui.Core.SDKGuide.html):
This worked well and prevents me from restructuring my code, so my question is this...Is this a safe way to force a XAML to load? I am assuming that the renderer resources will be deallocated after it goes out of scope, but the loaded XAML elements are still being kept in memory (which is what I need). Really, all I need is some form of commit call to force a complete loading of the XAML, is there a better way to do this?
So I am attempting to load a xaml dynamically with the following line:
Code: Select all
user_control_ = Noesis::Gui::LoadXaml<Noesis::Gui::FrameworkElement>(xaml_filename.c_str());
Code: Select all
NsSize numChildren = VisualTreeHelper::GetChildrenCount(user_control_);
Code: Select all
panel->GetChildren()->Add((Noesis::Gui::FrameworkElement*) root.GetPtr());
Code: Select all
Ptr<IRenderer> xamlRenderer = CreateRenderer(user_control_.GetPtr());