本文介绍了无法在“样式”的“目标”标签上指定事件“ LostFocus”。改用EventSetter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么会收到此错误消息?我正在使用事件设置器!
Why am I getting this error message? I'm using an event setter!
<Style TargetType="{x:Type xcdg:DataCell}">
<EventSetter Event="LostFocus" Handler="cellLostFocusHandler" />
</Style>
编辑
我没有使用内联样式。它在资源中,即:
I'm not using the style inline. It's in a resource, i.e.:
<DataGrid.Resources>
<Style TargetType="{x:Type xcdg:DataCell}">
<EventSetter Event="LostFocus" Handler="cellLostFocusHandler" />
</Style>
</DataGrid.Resources>
推荐答案
请参见
听起来您正在使用内联样式,而不是作为资源使用,并且设置内联样式的EventSetter时遇到的问题
It sounds like you're using the Style inline, instead of as a Resource, and there's issues in setting an EventSetter in an inline style
这篇关于无法在“样式”的“目标”标签上指定事件“ LostFocus”。改用EventSetter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!