在删除的用户控件下查找控件的最佳方法
我正在尝试对用户控件实现拖放功能。
我已经成功地使用谷歌使其正常工作,但是,当删除控件时,我希望找到可能位于或可能不位于其下的所有类似类型的控件。
我当前的方法是检查每个控件并查看它是否处于已删除的控件之下。但我想知道是否有更好的方法,比如查找控制函数,可以检查给定范围内的控件?
I'm trying to implement a drag-drop function to a usercontrol.
I've managed to get this working properly with the use of google, however, when dropping a control I wish to find every similar type controls that might be or might not be under it.
My current way would be check every control and see if it's under the dropped control. But I wonder if there is a better way, like a find control function which can check for controls within a given range?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以使用这个功能:
http://msdn.microsoft.com/en-us/library/system.windows.media.visualtreehelper.findelementsinhostcooperatives%28v=vs.95%29.aspx
或者您可以使用此功能仅在 MouseLeftButtonUp 事件中
you could use this function:
http://msdn.microsoft.com/en-us/library/system.windows.media.visualtreehelper.findelementsinhostcoordinates%28v=vs.95%29.aspx
Or you can just use this function only in MouseLeftButtonUp event
嗯..
Well..