如何将事件鼠标附加到具有依赖项属性的元素 [英] How can attach a event mouse down to element which have dependency property
本文介绍了如何将事件鼠标附加到具有依赖项属性的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想问你一路将事件附加到具有依赖属性的元素。
我确实没有效果。
1.注册表帮助ID
Hi Guys,
I would like to ask you all the way to attach event to element which has dependency property.
I did but got no effect.
1. registry help ID
public static readonly DependencyProperty HelpIDProperty =
DependencyProperty.RegisterAttached("HelpID", typeof(string), typeof(HelpProvider));
2 。将helpID设置为元素时附加事件
2. Attach event when setting helpID to element
public static void SetHelpID(DependencyObject obj, string value)
{
obj.SetValue(HelpIDProperty, value);
var element = obj as FrameworkElement;
if (element != null)
{
element.MouseDown += SensitiveElementOnMouseDown;
}
}
对这个帮助有什么想法
Is there any idea for this help
推荐答案
这可能对你有所帮助
鼠标事件命令 [ ^ ]
this might help you
Mouse Event Commands[^]
这篇关于如何将事件鼠标附加到具有依赖项属性的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文