You can load a xaml file dynamically as follows:
// This file should then be next to the exe. If not specify a relative path.
FileStream xamlFile = new FileStream('ChartWindow.xaml', FileMode.Open, FileAccess.Read);
Window win = XamlReader.Load(xamlFile) as Window;
Note that any code-behind associated with the above xaml will not be loaded/processed.
In case, you have an assembly reference to a custom dll in the above xaml file, you should reference that assembly with a fully qualified namespace as follows:
The above assembly should then be present in the GAC for the runtime to find it. Permalink