I'm trying to change the opacity of an item in my StackPanel, but it doesn't seem to do anything, I've searched online for this for about an hour now, and I can't seem to find what I've done wrong... This is my code:
<Window x:Class="Stations.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:Stations.Model"
xmlns:l="clr-namespace:Stations"
Title="SpeedControl" WindowState="Maximized">
<Window.Resources>
<m:SpeedControl x:Key="MySpeedControl" />
<m:NumberToMonthConverter x:Key="Converter" />
<m:NumberToBrushConverter x:Key="BrushConverter" />
<Style x:Key="Opacity1" TargetType="StackPanel">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="StackPanel.Opacity" Value="1" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<ItemsControl Margin="10" ItemsSource="{Binding Source={StaticResource MySpeedControl}, Path=DataList}">
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<Border BorderBrush="Aqua" BorderThickness="1" CornerRadius="15">
<ItemsPresenter/>
</Border>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<DataTemplate.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="12"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataTemplate.Resources>
<Grid Background="Transparent">
<StackPanel Width="145px" Height="45px" Margin="4px" Opacity="{Binding Path=ViolationsRate}" Background="{Binding Path=NumberOfChecks, Converter={StaticResource BrushConverter}}" Style="{StaticResource Opacity1}">
<TextBlock Text="{Binding Path=Street}" TextAlignment="Center" Foreground="White"/>
<TextBlock Text="{Binding Path=Month, Converter={StaticResource Converter}}" TextAlignment="Center" Foreground="White"/>
</StackPanel>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Window>
As you can see I've maed a Style in , and I call on it in my StackPanel, but the opacity won't change when I hover over the items in it