Created
November 5, 2016 12:06
-
-
Save ichengzi/fb24e3f462a7b0d248d5e85afb46dfac to your computer and use it in GitHub Desktop.
wpf triggers(property,data,event)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TextBlock Text="Hello"> | |
<TextBlock.Style> | |
<Style TargetType="TextBlock"> | |
<Setter Property="Foreground" Value="Blue"></Setter> | |
<Style.Triggers> | |
<Trigger Property="IsMouseOver" Value="True"> | |
<Setter Property="Foreground" Value="Red" /> | |
<Setter Property="TextDecorations" Value="Underline" /> | |
</Trigger> | |
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=Text}" Value="Hello"> | |
<!--<Setter Property="Text" Value="Yes!" />--> | |
<Setter Property="Foreground" Value="Green" /> | |
</DataTrigger> | |
<EventTrigger RoutedEvent="MouseEnter"> | |
<EventTrigger.Actions> | |
<BeginStoryboard> | |
<Storyboard> | |
<DoubleAnimation Duration="0:0:0.300" Storyboard.TargetProperty="FontSize" To="28" /> | |
</Storyboard> | |
</BeginStoryboard> | |
</EventTrigger.Actions> | |
</EventTrigger> | |
<EventTrigger RoutedEvent="MouseLeave"> | |
<EventTrigger.Actions> | |
<BeginStoryboard> | |
<Storyboard> | |
<DoubleAnimation Duration="0:0:0.800" Storyboard.TargetProperty="FontSize" To="18" /> | |
</Storyboard> | |
</BeginStoryboard> | |
</EventTrigger.Actions> | |
</EventTrigger> | |
</Style.Triggers> | |
</Style> | |
</TextBlock.Style> | |
</TextBlock> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment