내가 코드의이 비트가 있다고 가정하자 제어 :WPF 마우스 오버 트리거 효과
기본적으로<Window>
<Window.Resources>
<Color x:Key="MyColor"
A="255"
R="152"
G="152"
B="152" />
<DropShadowEffect x:Key="MyEffect"
ShadowDepth="0"
Color="{StaticResource MyColor}"
BlurRadius="10" />
<Style x:Key="MyGridStyle"
TargetType="{x:Type Grid}">
<Setter Property="Height"
Value="200" />
<Setter Property="Width"
Value="200" />
<Style.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Width"
Value="100" />
</Style>
<Style TargetType="{x:Type Image}">
<Setter Property="Height"
Value="100" />
<Setter Property="Width"
Value="100" />
</Style>
</Style.Resources>
<Style.Triggers>
<Trigger Property="IsMouseOver"
Value="true">
<!-- How do I apply my effect when this grid is hovered over to Image and TextBox, but not the grid itself? -->
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid Style="{StaticResource MyGridStyle}">
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image Grid.Row="0"
Grid.Column="0"
Source="image.png" />
<TextBlock Grid.Row="0"
Grid.Column="0"
Text="Hover Over Me" />
</Grid>
</Window>
I가 그 안에있는 TextBlock의 또는 이미지가 특정 크기에 스타일을해야 말한다 그리드에 적용되는 스타일 .
그리드에서 트리거를 생성하여 그리드 내의 모든 TextBlock 및 이미지에는 적용되지만 그리드에는 적용되지 않습니다.
트리거를 TextBlock 및/또는 Image에 직접 적용 할 수 있지만 효과는 각 요소에서만 별도로 발생합니다. 내부 TextBlock 및 Image에 영향을 주어야합니다.
아무도 도와 줄 수 있습니까?