日期:2014-05-17  浏览次数:20821 次

WPF,自定义窗口时移动窗口
我写了一个自定义窗口,窗口的最上方是一个Grid,看起来像是窗口的标题栏,并且我设置了移动窗口的代码:
private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) 
{
    this.DragMove();
}

不过,现在出现一个情况,当窗口最大化时,就拖不动窗口了,这是怎么回事呢?该如何修改?

------解决方案--------------------
窗口最大化以后,本来就拖不了窗口呀。
这是windows里的基本操作。
------解决方案--------------------
你在窗口拖动事件里面把窗口的大小属性设置为Normal就可以了 
------解决方案--------------------
小弟围观 ,呵呵
------解决方案--------------------
 if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed)
            {
                if (this.WinState == WindowState.Maximized)
                    this.WinState = WindowState.Normal;
                this.DragMove();
            }
------解决方案--------------------
 private void MouseMoveHandler(object sender, System.Windows.Input.MouseEventArgs e)
        {
            if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed)
            {
                if (this.WindowState == WindowState.Maximized)
                    this.WindowState = WindowState.Normal;
                this.DragMove();
            }
        }