[英]Absolute coordinates of UIElement in WinRT
Cannot find a way to locate absolute position of an UIElement
in Metro style app. 无法找到在Metro风格应用中定位
UIElement
绝对位置的方法。 Anybody know the solution? 有人知道解决方案吗?
(the context: I want a Popup to be shown next to the button called it) (上下文:我希望弹出窗口显示在名为它的按钮旁边)
This should work... 这应该工作......
private void Button_Click(object sender, RoutedEventArgs e)
{
var button = sender as Button;
var ttv = button.TransformToVisual(Window.Current.Content);
Point screenCoords = ttv.TransformPoint(new Point(0, 0));
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.