文章出處
文章列表
WPF原有的窗口樣式太丑,當我們重新定義窗口時,則需要添加一些額外的功能,如拖動~
1、在界面上對布局元素如Grid,添加委托事件: MouseLeftButtonDown="UIElement_OnMouseLeftButtonDown"
2、委托方法中處理一下就行了:
private void UIElement_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (e.ButtonState==MouseButtonState.Pressed) { this.DragMove(); } }
文章列表
全站熱搜