refactor: 将Framework库和RT、UI放在同一个解决方案中。

This commit is contained in:
SL
2026-06-01 17:48:28 +08:00
parent 1948f4290d
commit b73d39a6b1
4331 changed files with 506148 additions and 49363 deletions
@@ -0,0 +1,37 @@
using System.Windows;
using System.Windows.Input;
namespace WpfStyleableWindow.StyleableWindow
{
public static class WindowDragBehavior
{
public static readonly DependencyProperty LeftMouseButtonDrag = DependencyProperty.RegisterAttached("LeftMouseButtonDrag", typeof(Window), typeof(WindowDragBehavior), new UIPropertyMetadata(null, OnLeftMouseButtonDragChanged));
public static Window GetLeftMouseButtonDrag(DependencyObject obj)
{
return (Window)obj.GetValue(LeftMouseButtonDrag);
}
public static void SetLeftMouseButtonDrag(DependencyObject obj, Window window)
{
obj.SetValue(LeftMouseButtonDrag, window);
}
private static void OnLeftMouseButtonDragChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (sender is UIElement uIElement)
{
uIElement.MouseLeftButtonDown += buttonDown;
}
}
private static void buttonDown(object sender, MouseButtonEventArgs e)
{
UIElement uIElement = sender as UIElement;
if (uIElement.GetValue(LeftMouseButtonDrag) is Window window)
{
window.DragMove();
}
}
}
}