WPF 如何为 2 个不同的控制器设置鼠标悬停样式

WPF how to style mouse over for 2 different controllers

所以我有 ListView,在每个 Row 里面我有 NumericUpDown:

xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"

<ListView.Resources>
    <DataTemplate x:Key="MyDataTemplate2">
        <Grid>
            <Controls:NumericUpDown
                Minimum="0" 
                Maximum="50"
                Value="{Binding Path=Speed}"
                StringFormat="N1"                                    
                Width="50"
                MinWidth="50"
                Height="17"
                Interval="0.1"
                HorizontalAlignment="Left"
                HideUpDownButtons="True"
                Margin="15,0,0,0"/>
            <TextBlock Grid.Column="1" Margin="0,-4,0,0"  Text="{Binding Path=Value, ElementName=sliderColumn, StringFormat={}x{0:N0}}" 
                   FontSize="11" Foreground="Gainsboro" VerticalAlignment="Center" HorizontalAlignment="Left" />
        </Grid>
    </DataTemplate>
</ListView.Resources>

在我的 ListView.ItemContainerStyle 触发器中 Mouse Over:

<MultiTrigger>
    <MultiTrigger.Conditions>
        <Condition Property="IsMouseOver" Value="True"/>
    </MultiTrigger.Conditions>
    <Setter Property="Foreground" Value="White"></Setter>
    <Setter Property="Background" Value="#FF103766"/>
    <Setter Property="BorderBrush" Value="#FF103766"/>
    <Setter Property="BorderThickness" Value="0"/>
</MultiTrigger>

所以我想在这个 Trigger 中也改变我的 NumericUpDown Background 颜色,当我的鼠标超过特定 Row 时。 可能吗?

与 relativesource 的绑定应该可以解决问题

<Controls:NumericUpDown
     Minimum="0" 
     Maximum="50"
     Value="{Binding Path=Speed}"
     StringFormat="N1"                                    
     Width="50"
     MinWidth="50"
     Height="17"
     Interval="0.1"
     HorizontalAlignment="Left"
     HideUpDownButtons="True"
     Margin="15,0,0,0">
   <Controls:NumericUpDown.Style>
       <Style TargetType="Controls:NumericUpDown">
           <Style.Triggers>
               <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem}, Path=IsMouseOver}" Value="true">
                   <Setter Property="Background" Value="Red"/>
               </DataTrigger>
           </Style.Triggers>
       </Style>
   </Controls:NumericUpDown.Style>
</Controls:NumericUpDown>