提出两项WPF窗口一次? [英] Move two WPF windows at once?
问题描述
我的主要窗口催生多数民众赞成位于顶部,看起来像的主要组成部分的子窗口。我想与主要移动子窗口同步,但我不知道怎么样。
My main window has spawned a child window that's positioned on top to look like part of the main. I would like to move the child window in sync with the main but I'm not sure how.
我的主窗口中有哪些事件MouseLeftButtonDown调用该函数我自己的标题栏:
My main window has my own title bar which event MouseLeftButtonDown calls this function:
public void DragWindow(object sender, MouseButtonEventArgs args)
{
DragMove();
UpdateChildWindowPosition();
}
这导致DragMove()执行主窗口移到主窗口单独作为我拖动标题栏。不执行UpdateChildWindowPosition(),直到我释放,在它读取一些元素的坐标,并设置子窗口位置鼠标 - 你看到子窗口捕捉到这是不希望的位置
This results in DragMove() executing on the main window moves the main window alone as I drag the title bar. UpdateChildWindowPosition() is not executed until I release the mouse at which it reads some element coordinates and sets the child window position - you see the child window snap to the location which is not desired.
我怎么能有子窗口移动同步的主窗口?
How can I have the child window move in sync with the main window?
推荐答案
啊哈!
我的主要窗口有LocationChanged一个事件,我已经绑在我的UpdateChildWindowPosition()。当LocationChange火灾(杜)的位置变化,所以它连续射击,我移动窗口时DragMove()被我DragWindow上面贴执行。
My Main window has an event LocationChanged which I've tied to my UpdateChildWindowPosition(). LocationChange fires when (duh) the location changes so it's continuously firing as I move the window when DragMove() is being executed in my DragWindow posted above.
这篇关于提出两项WPF窗口一次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!