关闭Silverlight ChildWindow时如何知道它的位置
请帮我。
public myChildWindow()
{
InitializeComponent();
// set left and top from saved values
Margin = new Thickness(70, 50, 0, 0);
}
private void ChildWindow_Closed(object sender, EventArgs e)
{
// How to know the position of the ChildWindow when you close it ?
// get left and top for save values
...
}
Please, help me.
public myChildWindow()
{
InitializeComponent();
// set left and top from saved values
Margin = new Thickness(70, 50, 0, 0);
}
private void ChildWindow_Closed(object sender, EventArgs e)
{
// How to know the position of the ChildWindow when you close it ?
// get left and top for save values
...
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
哎呀,你是对的,试试这个:
将窗口连接到以下事件(我通过简单的按钮单击完成了此操作)
现在您需要做的是遍历 ChildWindow PARTS DOM 并找到将为您提供位置的 ContentRoot。
HTH。
Oops you are right, try this:
Wire up the window to the following events (I did this via simple button click)
Now what you need to do is walk the ChildWindow PARTS DOM and find the ContentRoot which will give you the position.
HTH.
如果您订阅了 Closing 事件而不是 Closed 事件,您可以从窗口中找到 Left/Top 值,
即:
然后要获取位置值,请使用:
You can find out the Left/Top values from the Window provided you are subscribing to the Closing event and not Closed
ie:
Then to get the position values use: