I’ve code like that
<Window x:Class="SolutionName.ClassName"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300" WindowStartupLocation="CenterOwner">
<Window.Style>
<Style TargetType="Window">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=ItemKind}" Value="SomeKind">
<Setter Property="Title" Value="SomeTitle"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=ItemKind}" Value="SomeKind2">
<Setter Property="Title" Value="SomeTitle"/>
</DataTrigger>
I want is to change window title depending on a property ItemKind implemented in the viewmodel (set as datacontext). The code above won’t work and I’m really confused because can’t find any mistakes.
The code seems fine and working at my end. Have you implemented
INotifyPropertyChangedin your ViewModel class. You need to implement it to so as to propagate any change in property value in your ViewModel class to reflect back on your UI.How to: Implement Property Change Notification