本文介绍了在WPF中悬停文本块时前景色不会改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好, 我在Wpf工作我在文本块上设置Trigger以更改背景和前景但前景颜色不会改变.. 请帮助... 我的代码是 < 样式 x:键 = LeftHoverBackground TargetType = {x:Type TextBlock} > < ; Setter Property = TextBlock .ForegroundValue =#404041/> < Style .Triggers> < Trigger Property =IsMouseOverValue =True> < Setter Property =TextBlock.ForegroundValue =White> < / Setter > < Setter 属性 = 背景 值 = #1A1A1A > < / Setter > < / Trigger > < / Style.Triggers > < / Style > 解决方案 hi all,I am working in Wpf I set Trigger on textblock for Change Background and Foreground But Foreground Color is Not Change..Please Help...my code is<Style x:Key="LeftHoverBackground" TargetType="{x:Type TextBlock}"> <Setter Property= "TextBlock.Foreground" Value="#404041"/> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="TextBlock.Foreground" Value="White"> </Setter> <Setter Property="Background" Value="#1A1A1A"> </Setter> </Trigger> </Style.Triggers> </Style> 解决方案 这篇关于在WPF中悬停文本块时前景色不会改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-29 20:33