In xaml I have :
<UserControl.Resources>
<Style x:Key = "TriggerStyle" TargetType = "Button">
<Setter Property = "Foreground" Value = "Blue" />
<Style.Triggers>
<Trigger Property = "IsMouseOver" Value = "True">
<Setter Property = "Foreground" Value = "{Binding BackgroundColor, Mode=TwoWay}" />
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid>
<Button Width = "100" Height = "70" Style = "{StaticResource TriggerStyle}" Content = "Trigger"/>
</Grid>
Inthe view model I set the background color to green. In the viewModel I have:
private void GetBackgroundColor()
{
return _brush = Brushes.Green;
}
public Brush BackgroundColor
{
get
{
return _brush;
}
set
{
_brush = value;
OnPropertyChanged("BackgroundColor");
}
}
In the debug mode, the brush has the value, but on screen nothing happens. What I'm doing wrong?