如何确定 WPF 中标签的顶部/左侧位置?
我有一个包含在 FlowLayoutPanel 中的 WPF 标签,我想确定用鼠标单击时标签的位置。 我试图将弹出控件放置在靠近标签的位置,并且只需要它的位置。
I have a WPF label contained in a FlowLayoutPanel and I want to determine the position of the label when clicked with the mouse. I am trying to position a pop-up control where near to the label and just need it's location.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Popup
控件内置了此功能。 您可以使用Placement
、PlacementTarget
、HorizontalOffset
和VerticalOffset
属性来控制它。也就是说,如果您确实想找到相对于另一个控件的点,请使用
UIElement.TranslatePoint
方法。The
Popup
control has this ability built-in. You can use thePlacement
,PlacementTarget
,HorizontalOffset
andVerticalOffset
properties to control it.That said, if you really want to find a point relative to another control, use the
UIElement.TranslatePoint
method.