Reputation: 307
In WPF it is possible to load XAML at runtime and put it in a ContentControl using XamlReader.Load()
Is this possible in Avalonia?
I want to get to a point where I have a user control that contains a content control and based on my configuration, this could point to a file on disk having XAML code to read.
In WPF this works nicely, and the XAML is imported, parsed and the datacontext is inherited, allowing my to put data inside the loaded XAML through my databindings.
I have been searching for an equivalent in Avalonia, but not been successfull.
Upvotes: 1
Views: 2275
Reputation: 3623
Install Avalonia.Markup.Xaml.Loader
package and use AvaloniaRuntimeXamlLoader class.
Upvotes: 3