I have a certain folder with a couple of view classes (XAML files). Right now i am instantiating these by code:
engineRoomView = new EngineRoomView()
{
DataContext = new ProcessViewModel()
};
and then further down:
item = new TabItem();
item.Contents = engineRoomView;
item.Name = "Engine Room";
views.Add(item);
What I want to achieve is some kind of dynamic code for creating one instance of each view in that particular folder without knowing about them during programming.
If a developer adds another xaml file to that folder. Then this gets created in run-time.
Something imaginary like:
Foreach(file in folder)
{
magicInstance = createInstanceFromFile(file);
MainViewModel.addView(magicInstance);
}
Is this possible?