How to trigger DataTemplateSelector when property changes?

As you requested an example with datatriggers in the comments, here you are: A FrameworkElement can only have EventTriggers, therefore you get the error Message Triggers collection members must be of type EventTrigger And also don’t use a ContentPresenter directly, it is meant to be used inside a ControlTemplate. Better use a ContentControl when you … Read more

WPF: Reapply DataTemplateSelector when a certain value changes

I found this workaround that seems easier to me. From within the TemplateSelector listen to the property that your care about and then reapply the template selector to force a refresh. public class DataSourceTemplateSelector : DataTemplateSelector { public DataTemplate IA { get; set; } public DataTemplate Dispatcher { get; set; } public DataTemplate Sql { … Read more