2

ラップパネル付きのスタックパネルがあります。

ユーザーがラップパネルにカーソルを合わせたときに、背景を現在の背景よりも少し明るくしたいので、ユーザーがクリックできることは明らかです。

背景はビューモデルにバインドされており、変更できます。

Converter を使用して、列挙型を特定の色に変換します。

<StackPanel x:Name="UserCallAlarmPanel" >
    <StackPanel.Resources>
         <Style x:Key="AlarmStyle" TargetType="{x:Type WrapPanel}">
             <Setter Property="Background" Value="Transparent"/>
             <Style.Triggers>
                 <DataTrigger Binding="{Binding IsMouseOver, ElementName=AlarmPanel}" Value="True" >
                     <Setter Property="Background" Value="{Binding CallStatus, Converter={StaticResource CallStatusBackgroundConverter}}"/>
                     <Setter Property="Opacity" Value="20"/>
                 </DataTrigger>
            </Style.Triggers>
        </Style>
    </StackPanel.Resources>

    <WrapPanel Name="AlarmPanel" Height="25" MouseLeftButtonDown="AlarmPanel_MouseLeftButtonDown" Style="{StaticResource AlarmStyle}">
        <Viewbox> 
            <ContentControl Content="{DynamicResource alarm_icon}"/>
        </Viewbox
    </WrapPanel>
</StackPanel>

不透明度に変更しようとしましたが、うまくいきません。

4

1 に答える 1