009_DI-Elec/newFront/c#前端/SWS.CAD/Views/CustomControl/customWindowTitleBar.xaml.cs

28 lines
779 B
C#
Raw Normal View History

2025-08-15 16:34:31 +08:00
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace SWS.CAD.Views.CustomControl
{
/// <summary>
/// Interaction logic for customWindowTitleBar.xaml
/// </summary>
public partial class customWindowTitleBar : UserControl
{
public customWindowTitleBar()
{
InitializeComponent();
}
private void Border_MouseDown(object sender, MouseButtonEventArgs e)
{
// 将事件传递给父窗口,要求窗口进行拖动
if (e.ChangedButton == MouseButton.Left)
{
var window = Window.GetWindow(this); // 获取父窗口
window?.DragMove(); // 调用窗口的 DragMove 方法
}
}
}
}