I have the following singleton class which contains the following property:
public class Manager : INotifyPropertyChanged
{
public bool IsOnline
...
public static Manager Instance
...
}
In the mark-up I am trying to change the color of a button based on this online property:
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Value="True">
<DataTrigger.Binding>
<Binding Source="{x:Static storage:Manager.Instance}" Path="IsOnline"/>
</DataTrigger.Binding>
<Setter Property="Background" Value="#8000FF00"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
This binding <Binding Source="{x:Static storage:Manager.Instance}" Path="IsOnline"/>
fails with the exception:
Cannot convert the value in attribute 'Source' to object of type 'System.Windows.Markup.StaticExtension'.
I have quadruple-checked the "storage" namespace; I know it is both referenced and correct. The Instance property is static, so I do not understand why this binding would fail. I have similar bindings to static properties all over that work just fine.
Any ideas?