2024. 8. 22. 18:37ㆍ카테고리 없음
wpf에서 textblock의 글자를 마우스오버시 글자색을 바꾸는 프로그램
<Window x:Class="YourNamespace.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TextBlock MouseOver Example" Height="300" Width="400">
<Grid>
<TextBlock Text="Hover over me!" FontSize="16" Foreground="Green">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Blue" />
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</Window>