forum

Home / DeveloperSection / Forums / C# - load xaml file at runtime

C# - load xaml file at runtime

Anonymous User 2706 02-Mar-2015

I have a WPF application in C#.

I have a MainWindow class which inherits from a System.Windows.Window class.

Next I have an xaml file on my disk which I want to load at runtime:

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="I want to load this xaml file">
</Window>                                      

How can I load that xaml file at runtime? In other words, I want my MainWindow class to use exactly the mentioned xaml file, so I do not want to use the method AddChild of the MainWindow because it adds a child to the window, but I want to replace also that Window parameter. How can I achieve this?


c# c#  .net  wpf  xaml 
Updated on 03-Mar-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By