I am using MVVM architecture to separate my application. That is, you often see something like
var u = new UserControl(); u.Content = new MyCustomType();
The user interface is defined using data templates found in resource dictionaries in their own XAML files.
<ResourceDictionary ...> <DataTemplate DataType="{x:Type local:MyCustomType}"> ...
I load resources when the application starts, and the application happily displays my user interface. But if I delete the data template and add a new one (same key, same data type), the user interface still uses the old data template. Of course, I can reinstall the contents of my container for a forced update, but that seems silly because I have to notify each control about the change, like this
var tmp = control.Content; control.Content = null; control.Content = tmp;
Any other approaches?
source share