I want to create a Window in WPF while the application is running. WHY? Its part of my modell driven design. It is not the window only. I want to load a XAML file and the window class behind the XAML. What i know is how to create a simple class with System.CodeDom.Compiler. But on a window i need the "MyWindow.i.g.cs" file, the "class MyWindow : Window" and my XAML file. What i want? I want set up databindings on the dynamic window in the constructor.
A little bit information behind my project: I got a generator that generates code and xaml files from a modell. I got a Database that is holding the c# code and xaml file in combination for each Window. Now i got an application that load the windows by names from the database, compile and show it. My Problem here is the declaration of my xaml Member (this.txt_Maintype). The compiler says "this is no member of Mainwindow".
public partial class MainWindow : Window
{
public MainWindow()
{
TypeClass content;
content = new TypeClass();
this.DataContext = content;
this.txt_Maintype.DataContext = content.Property_ident_deklaration;
this.txt_template.DataContext = content.Property_ident_deklaration;
this.txt_Extentiontype.DataContext = content.Property_ident_deklaration;
}
}
And the Method InitializeComponent() is not defined. I know there is an *.i.g.cs file in visual studio that implements the InitializeComponent. So how to merge all these files to compile it?
Thanks for help
I hope you understand what i want. It is difficult to explain it.