本文介绍了Mouse.DirectlyOver在WPF中返回错误的UIElement的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

虽然我尝试将鼠标悬停在标签"元素,  Mouse.DirectlyOver,它返回"TextBlock".因此.为什么会这样?

      private void Dynamic_Design_PreviewMouseMove(对象发送方,MouseEventArgs e)
        {
            if(e.LeftButton == MouseButtonState.Pressed)
            {
                  var uiElement = Mouse.DirectlyOver as UIElement;
            }
        }
对此有任何想法吗??


谢谢,
Sowndaiyan

Hi All,

While i try to mouse over on the "Label" element , Mouse.DirectlyOver it returns the "TextBlock" as a result. Why it happen like this?

     private void Dynamic_Design_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            if(e.LeftButton == MouseButtonState.Pressed)
            {
                 var uiElement = Mouse.DirectlyOver as UIElement;
            }
        }
Any idea on this..?


Thanks,
Sowndaiyan

推荐答案


这篇关于Mouse.DirectlyOver在WPF中返回错误的UIElement的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 15:12