问题触发器 [英] Question Trigger

查看:96
本文介绍了问题触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< 样式 >


< Style.Triggers >


< 触发器
Property
=" IsMouseOver"
=" True">


< Setter
Property
="背景"
=" Red">< / Setter > < / 触发器 >


< / Style.Triggers >


< / 样式 >


I
想要更改按钮的背景颜色,我使用background属性导致错误


错误
属性'背景'不是
类型FrameworkElement

解决方案

尝试在你的Style上设置TargetType。否则你将尝试定位最基本类型(FrameworkElement);


< span style ="font-family:Consolas;颜色:#0000FF; font-size:x-small"> < 样式
TargetType
="按钮">


 



 



 




hth


标记


<Style>

<Style.Triggers>

<Trigger Property="IsMouseOver" Value="True">

<Setter Property="Background" Value="Red"></Setter></Trigger>

</Style.Triggers>

</Style>

I want to change the background color of the button, I use the background attribute the errors they cause

Error Property 'Background' was not found in type FrameworkElement

解决方案

Try setting the TargetType on your Style. Otherwise you'll be trying to target the base-most type (FrameworkElement);

<Style TargetType="Button">

 

 

 

hth

Mark


这篇关于问题触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆