答案 0 :(得分:1)
只需将一个PreviewMouseDown
事件附加到Button并使用类似的代码
XAML
<Button PreviewMouseDown="Move" />
或CodeBehind
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;
}