2017-07-17 103 views

回答

0

一個PreviewMouseDown事件只是附加到按鈕,並使用類似的代碼

XAML

<Button PreviewMouseDown="Move" /> 

或代碼隱藏

Button button = new Button(); 
button.PreviewMouseDown += Move; 

代碼

private void Move(object sender, RoutedEventArgs e) 
{ 
    // "window" is the name of the window 
    window.DragMove(); 
    e.Handled = true; 
} 
+0

我試過了,它沒有工作 – Exitialis

+0

檢查我的編輯,爲我工作 –

+0

工作,謝謝! – Exitialis