in my wpf application I am trying to change the window title bar depending on a specific static boolean variable. The idea is that no matter where I update this static flag the window title changes. If it's true then Title = "** Foo" else Title = "Foo".
Attempt number one:
I created a static boolean in my MainViewModel
public static bool RefreshTitleBar { get; set;}
And in my MainWindowView.xaml made this change:
<Window.Resources>
<Style TargetType="Window">
<Style.Triggers>
Binding="{Binding Source={x:Static viewModel:MainViewModel.RefreshTitleBar}, UpdateSourceTrigger=PropertyChanged}" Value="True">
<Setter Property="Title" Value="--Foo"/>
</DataTrigger>
Binding="{Binding Source={x:Static viewModel:MainViewModel.RefreshTitleBar}, UpdateSourceTrigger=PropertyChanged}" Value="False">
<Setter Property="Title" Value="Foo"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
But it doesn't update when RefreshTitleBar value changes. I have other properties working with binding so I know that's not the issue.
What am I missing here? Can someone help me understand why my title bar can't work? Is a title bar one of those things that simply can't be updated once it's set the first time? Many thanks in advance.