diff --git a/NeoUI/NeoUI/Assists/AnchorAssist.cs b/NeoUI/NeoUI/Assists/AnchorAssist.cs
index 1ec07c9..0def167 100644
--- a/NeoUI/NeoUI/Assists/AnchorAssist.cs
+++ b/NeoUI/NeoUI/Assists/AnchorAssist.cs
@@ -41,9 +41,4 @@ public class AnchorAssist
{
obj.SetValue(HeaderProperty, value);
}
-
-
-
-
-
}
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Controls/Alert.xaml b/NeoUI/NeoUI/Controls/Alert.xaml
index 979abc5..6edb144 100644
--- a/NeoUI/NeoUI/Controls/Alert.xaml
+++ b/NeoUI/NeoUI/Controls/Alert.xaml
@@ -1,24 +1,24 @@
+ xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
-
-
+
-
+
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Controls/CalendarStyle.xaml b/NeoUI/NeoUI/Controls/Calendar.xaml
similarity index 76%
rename from NeoUI/NeoUI/Controls/CalendarStyle.xaml
rename to NeoUI/NeoUI/Controls/Calendar.xaml
index f1d4c19..91babab 100644
--- a/NeoUI/NeoUI/Controls/CalendarStyle.xaml
+++ b/NeoUI/NeoUI/Controls/Calendar.xaml
@@ -1,13 +1,12 @@
+ xmlns:controls="clr-namespace:NeoUI.Controls"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
-
-
-
-
+
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Controls/Cascader.xaml b/NeoUI/NeoUI/Controls/Cascader.xaml
index a0f1e24..3a6072b 100644
--- a/NeoUI/NeoUI/Controls/Cascader.xaml
+++ b/NeoUI/NeoUI/Controls/Cascader.xaml
@@ -1,18 +1,18 @@
+ xmlns:internal="clr-namespace:NeoUI.Converters.Internal"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
-
-
-
+
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Controls/Pill.xaml b/NeoUI/NeoUI/Controls/Chip.xaml
similarity index 97%
rename from NeoUI/NeoUI/Controls/Pill.xaml
rename to NeoUI/NeoUI/Controls/Chip.xaml
index 318ba3d..0d7fa70 100644
--- a/NeoUI/NeoUI/Controls/Pill.xaml
+++ b/NeoUI/NeoUI/Controls/Chip.xaml
@@ -5,7 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
-
-
+
+
-
+
+ VerticalOffset="4"
+ x:Name="PART_Popup">
-
-
+ CornerRadius="4"
+ Margin="8"
+ MaxHeight="{TemplateBinding MaxDropDownHeight}"
+ MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
+ x:Name="dropDownBorder">
+
+
+ SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
+ x:Name="ItemsPresenter" />
+ Margin="-4"
+ Style="{StaticResource ComboBoxToggleButton}"
+ x:Name="toggleButton" />
+ Margin="{TemplateBinding BorderThickness}"
+ x:Name="border">
+ x:Name="PART_EditableTextBox" />
+ x:Name="Placeholder">
-
+
-
-
-
+
+
-
+
+ VerticalOffset="4"
+ x:Name="PART_Popup">
-
-
+ CornerRadius="4"
+ Margin="8"
+ MaxHeight="{TemplateBinding MaxDropDownHeight}"
+ MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
+ x:Name="dropDownBorder">
+
+
+ SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
+ x:Name="ItemsPresenter" />
-
+
+ Margin="{TemplateBinding Padding}"
+ SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
+ VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+ x:Name="contentPresenter" />
-
-
+
+
-
+
@@ -593,18 +595,18 @@
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -464,7 +463,7 @@
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
SnapsToDevicePixels="True">
-
+
@@ -481,7 +480,7 @@
@@ -532,25 +531,24 @@
-
+
-
+
-
-
-
-
-
-
+
+
+
+
+
@@ -590,7 +587,7 @@
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
SnapsToDevicePixels="True">
-
+
@@ -607,7 +604,7 @@
@@ -658,16 +655,16 @@
-
+
-
+
-
+
-
-
+
-
-
-
+
+
-
+
+ VerticalOffset="4"
+ x:Name="PART_Popup">
-
-
+ CornerRadius="4"
+ Margin="8"
+ MaxHeight="{TemplateBinding MaxDropDownHeight}"
+ MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
+ x:Name="dropDownBorder">
+
+
+ SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
+ x:Name="ItemsPresenter" />
-
+
+ Margin="{TemplateBinding Padding}"
+ SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
+ VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+ x:Name="contentPresenter" />
-
-
+
+
-
+
@@ -188,14 +188,14 @@
-
-
-
+
+
+
-
-
+
-
-
-
-
-
+
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Controls/ListViewStyle.xaml b/NeoUI/NeoUI/Controls/ListView.xaml
similarity index 85%
rename from NeoUI/NeoUI/Controls/ListViewStyle.xaml
rename to NeoUI/NeoUI/Controls/ListView.xaml
index 8c891a3..8df9864 100644
--- a/NeoUI/NeoUI/Controls/ListViewStyle.xaml
+++ b/NeoUI/NeoUI/Controls/ListView.xaml
@@ -1,22 +1,22 @@
-
+
+
+
+
+
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Controls/WindowStyle.xaml b/NeoUI/NeoUI/Controls/NeoWindow.xaml
similarity index 77%
rename from NeoUI/NeoUI/Controls/WindowStyle.xaml
rename to NeoUI/NeoUI/Controls/NeoWindow.xaml
index ec29f58..77d2d20 100644
--- a/NeoUI/NeoUI/Controls/WindowStyle.xaml
+++ b/NeoUI/NeoUI/Controls/NeoWindow.xaml
@@ -4,6 +4,78 @@
xmlns:assists="clr-namespace:NeoUI.Assists"
xmlns:controls="clr-namespace:NeoUI.Controls"
xmlns:effects="clr-namespace:NeoUI.Effects">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/// NeoWindow 类继承自 WPF 的 Window 类,用于创建具有特定样式和功能的窗口。
+/// 该类通过设置默认样式资源引用来自定义窗口外观,并提供属性来控制窗口的行为和内容布局。
+///
+public class NeoWindow : Window
+{
+ private const string VbMinimizeButtonName = "minimizeButton";
+ private const string VbMaximizeRestoreButtonName = "maximizeRestoreButton";
+ ///
+ /// 用于在XAML模板中标识关闭按钮的名称。
+ /// 此常量字符串值为 "closeButton",用于在窗口样式应用时通过GetTemplateChild方法查找对应的关闭按钮控件。
+ ///
+ private const string VbCloseButtonName = "closeButton";
+ ///
+ ///
+ ///
+ public NeoWindow()
+ {
+ SetResourceReference(StyleProperty, typeof(NeoWindow)); //设置默认的样式资源引用
+ }
+ #region 自定义标题栏按钮行为
+
+ protected override void OnSourceInitialized(EventArgs e)
+ {
+ base.OnSourceInitialized(e);
+ var helper = new WindowInteropHelper(this);
+ var hwndSource = HwndSource.FromHwnd(helper.Handle);
+ hwndSource?.AddHook(HwndSourceHook);
+ }
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ private static extern bool TrackMouseEvent(ref TRACKMOUSEEVENT lpEventTrack);
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct TRACKMOUSEEVENT
+ {
+ public int cbSize;
+ public uint dwFlags;
+ public IntPtr hwndTrack;
+ public uint dwHoverTime;
+
+ public TRACKMOUSEEVENT(uint dwFlags, IntPtr hwndTrack)
+ {
+ this.cbSize = Marshal.SizeOf(typeof(TRACKMOUSEEVENT));
+ this.dwFlags = dwFlags;
+ this.hwndTrack = hwndTrack;
+ this.dwHoverTime = 0;
+ }
+ }
+
+ private const int WM_NCHITTEST = 0x0084;
+ private const int WM_NCMOUSEMOVE = 0x00A0;
+ private const int WM_NCMOUSELEAVE = 0x02A2;
+ private const int WM_NCLBUTTONDOWN = 0x00A1;
+ private const int WM_NCLBUTTONUP = 0x00A2;
+ private const int HTMAXBUTTON = 9;
+ private const uint TME_LEAVE = 0x00000002;
+ private const uint TME_NONCLIENT = 0x00000010;
+
+ #endregion
+
+ private bool isMouseOverMaximizeButton = false;
+ private bool isMaximizeButtonPressed = false;
+
+ private IntPtr HwndSourceHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
+ {
+ switch (msg)
+ {
+ case WM_NCHITTEST:
+ if (IsMouseOverMaximizeButton(lParam))
+ {
+ handled = true;
+ return new IntPtr(HTMAXBUTTON);
+ }
+ else if (isMouseOverMaximizeButton || isMaximizeButtonPressed)
+ {
+ // 如果鼠标移出按钮区域,重置状态
+ isMouseOverMaximizeButton = false;
+ isMaximizeButtonPressed = false;
+ UpdateMaximizeButtonVisualState();
+ }
+ break;
+
+ case WM_NCMOUSEMOVE:
+ bool isCurrentlyOver = IsMouseOverMaximizeButton(lParam);
+ if (isCurrentlyOver != isMouseOverMaximizeButton)
+ {
+ isMouseOverMaximizeButton = isCurrentlyOver;
+ UpdateMaximizeButtonVisualState();
+
+ if (isMouseOverMaximizeButton)
+ {
+ var tme = new TRACKMOUSEEVENT(TME_LEAVE | TME_NONCLIENT, hwnd);
+ TrackMouseEvent(ref tme);
+ }
+ }
+ break;
+
+ case WM_NCMOUSELEAVE:
+ isMouseOverMaximizeButton = false;
+ isMaximizeButtonPressed = false;
+ UpdateMaximizeButtonVisualState();
+ break;
+
+ case WM_NCLBUTTONDOWN:
+ if (isMouseOverMaximizeButton)
+ {
+ isMaximizeButtonPressed = true;
+ UpdateMaximizeButtonVisualState();
+ handled = true;
+ }
+ break;
+
+ case WM_NCLBUTTONUP:
+ if (isMaximizeButtonPressed)
+ {
+ isMaximizeButtonPressed = false;
+ UpdateMaximizeButtonVisualState();
+
+ if (isMouseOverMaximizeButton)
+ {
+ maximizeRestoreButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
+ }
+ handled = true;
+ }
+ break;
+ }
+
+ return IntPtr.Zero;
+ }
+
+ private bool IsMouseOverMaximizeButton(IntPtr lParam)
+ {
+ var x = (short)(lParam.ToInt32() & 0xFFFF);
+ var y = (short)(lParam.ToInt32() >> 16);
+ var mousePos = new Point(x, y);
+
+ var windowPos = this.PointFromScreen(mousePos);
+
+ var maximizeButtonVisual = maximizeRestoreButton as Visual;
+ if (maximizeButtonVisual != null)
+ {
+ var bounds = VisualTreeHelper.GetDescendantBounds(maximizeButtonVisual);
+ var buttonTransform = maximizeButtonVisual.TransformToAncestor(this);
+ var buttonRect = buttonTransform.TransformBounds(bounds);
+
+ return buttonRect.Contains(windowPos);
+ }
+
+ return false;
+ }
+
+ private void UpdateMaximizeButtonVisualState()
+ {
+ string stateName;
+ if (isMaximizeButtonPressed && isMouseOverMaximizeButton)
+ {
+ stateName = "Pressed";
+ }
+ else if (isMouseOverMaximizeButton)
+ {
+ stateName = "MouseOver";
+ }
+ else
+ {
+ stateName = "Normal";
+ }
+ //VisualStateManager.GoToState(maximizeRestoreButton, stateName, true);
+ switch (stateName)
+ {
+ case "Pressed":
+ //VisualStateManager.GoToState(maximizeRestoreButton, "Pressed", true);
+ maximizeRestoreButton.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#33000000"));
+ break;
+ case "MouseOver":
+ maximizeRestoreButton.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1A000000"));
+ //VisualStateManager.GoToState(maximizeRestoreButton, "MouseOver", true);
+ break;
+ case "Normal":
+ maximizeRestoreButton.Background = Brushes.Transparent;
+ //VisualStateManager.GoToState(maximizeRestoreButton, "Normal", true);
+ break;
+ }
+ }
+
+ #region Window Control Methods
+
+ private void TitleBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ if (e.ClickCount == 2)
+ {
+ ToggleWindowState();
+ }
+ else
+ {
+ this.DragMove();
+ }
+ }
+
+ private void maximizeRestoreButton_Click(object sender, RoutedEventArgs e)
+ {
+ ToggleWindowState();
+ }
+
+ private void ToggleWindowState()
+ {
+ this.WindowState = (this.WindowState == WindowState.Normal) ? WindowState.Maximized : WindowState.Normal;
+ }
+
+ private void CloseButton_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+
+ #endregion
+ static NeoWindow()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(NeoWindow), new FrameworkPropertyMetadata(typeof(NeoWindow)));
+ }
+ ///
+ /// 如果窗口不活动,请让窗口的内容淡出。
+ /// 默认值为真(已启用)。
+ ///
+ public static readonly DependencyProperty FadeContentIfInactiveProperty = DependencyProperty.Register(
+ nameof(FadeContentIfInactive), typeof(bool), typeof(NeoWindow), new FrameworkPropertyMetadata(true));
+
+ ///
+ /// 如果窗口不活动,请让窗口的内容淡出。
+ /// 默认值为真(已启用)。
+ ///
+ public bool FadeContentIfInactive
+ {
+ get => (bool)GetValue(FadeContentIfInactiveProperty);
+
+ set => SetValue(FadeContentIfInactiveProperty, value);
+ }
+
+ ///
+ /// 标题栏左侧内容模板
+ ///
+ public object TitleBarLeftContent
+ {
+ get => (object)GetValue(TitleBarLeftContentProperty);
+ set => SetValue(TitleBarLeftContentProperty, value);
+ }
+
+ ///
+ /// 用于定义窗口左侧内容区域的数据模板。
+ /// 此依赖属性允许开发者自定义左侧内容的布局和显示方式,通过设置不同的DataTemplate来改变该区域的内容呈现形式。
+ ///
+ public static readonly DependencyProperty TitleBarLeftContentProperty =
+ DependencyProperty.Register(nameof(TitleBarLeftContent), typeof(object), typeof(NeoWindow));
+ ///
+ /// 标题栏右侧内容模板
+ ///
+ public object TitleBarRightContent
+ {
+ get => (object)GetValue(TitleBarRightContentProperty);
+ set => SetValue(TitleBarRightContentProperty, value);
+ }
+
+ ///
+ /// 用于定义窗口右侧内容区域的数据模板。
+ /// 此依赖属性允许开发者自定义右侧内容的布局和显示方式,通过设置不同的DataTemplate来改变该区域的内容呈现形式。
+ ///
+ public static readonly DependencyProperty TitleBarRightContentProperty =
+ DependencyProperty.Register(nameof(TitleBarRightContent), typeof(object), typeof(NeoWindow));
+ private Button? minimizeButton;
+ private Button? maximizeRestoreButton;
+ private Button? closeButton;
+
+ ///
+ public override void OnApplyTemplate()
+ {
+ if (minimizeButton != null)
+ {
+ minimizeButton.Click -= MinimizeButtonClickHandler;
+ }
+
+ minimizeButton = GetTemplateChild(VbMinimizeButtonName) as Button;
+
+ if (minimizeButton != null)
+ {
+ minimizeButton.Click += MinimizeButtonClickHandler;
+ }
+
+ if (maximizeRestoreButton != null)
+ {
+ maximizeRestoreButton.Click -= MaximizeRestoreButtonClickHandler;
+ }
+
+ maximizeRestoreButton = GetTemplateChild(VbMaximizeRestoreButtonName) as Button;
+
+ if (maximizeRestoreButton != null)
+ {
+ maximizeRestoreButton.Click += MaximizeRestoreButtonClickHandler;
+ }
+
+ if (closeButton != null)
+ {
+ closeButton.Click -= CloseButtonClickHandler;
+ }
+
+ closeButton = GetTemplateChild(VbCloseButtonName) as Button;
+
+ if (closeButton != null)
+ {
+ closeButton.Click += CloseButtonClickHandler;
+ }
+
+ base.OnApplyTemplate();
+ }
+
+ private void CloseButtonClickHandler(object sender, RoutedEventArgs args)
+ {
+ Close();
+ }
+
+ private void MaximizeRestoreButtonClickHandler(object sender, RoutedEventArgs args)
+ {
+ WindowState = (WindowState == WindowState.Normal) ? WindowState.Maximized : WindowState.Normal;
+ }
+
+ private void MinimizeButtonClickHandler(object sender, RoutedEventArgs args)
+ {
+ WindowState = WindowState.Minimized;
+ }
+}
diff --git a/NeoUI/NeoUI/Controls/NeuComboBox.xaml b/NeoUI/NeoUI/Controls/NeuComboBox.xaml
index 481d147..ca5647d 100644
--- a/NeoUI/NeoUI/Controls/NeuComboBox.xaml
+++ b/NeoUI/NeoUI/Controls/NeuComboBox.xaml
@@ -1,13 +1,13 @@
+ xmlns:converters="clr-namespace:NeoUI.Converters"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
+
-
-
-
-
-
-
+
+
+ RadiusY="4"
+ x:Name="border" />
+ Style="{StaticResource ScrollBarButtonStyle}"
+ assists:ButtonAssist.Icon="{markup:Icon SymbolValue=ArrowDropUp}"
+ x:Name="PART_LineUpButton" />
+ Style="{StaticResource ScrollBarButtonStyle}"
+ assists:ButtonAssist.Icon="{markup:Icon SymbolValue=ArrowDropDown}"
+ x:Name="PART_LineDownButton" />
-
+
@@ -266,61 +265,61 @@
-
-
+
+
-
-
+
+
+ RadiusY="4"
+ x:Name="border" />
+ Style="{StaticResource ScrollBarButtonStyle}"
+ assists:ButtonAssist.Icon="{markup:Icon SymbolValue=ArrowLeft}"
+ x:Name="PART_LineLeftButton" />
+ Style="{StaticResource ScrollBarButtonStyle}"
+ assists:ButtonAssist.Icon="{markup:Icon SymbolValue=ArrowRight}"
+ x:Name="PART_LineRightButton" />
-
+
@@ -329,8 +328,8 @@
-
-
+
+
@@ -360,7 +359,7 @@
-
+
@@ -370,38 +369,38 @@
-
+
+ x:Name="PART_VerticalScrollBar" />
+ x:Name="PART_HorizontalScrollBar" />
diff --git a/NeoUI/NeoUI/Controls/Separator.xaml b/NeoUI/NeoUI/Controls/Separator.xaml
new file mode 100644
index 0000000..6ea8bda
--- /dev/null
+++ b/NeoUI/NeoUI/Controls/Separator.xaml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Controls/SeparatorStyle.xaml b/NeoUI/NeoUI/Controls/SeparatorStyle.xaml
deleted file mode 100644
index 6a32b72..0000000
--- a/NeoUI/NeoUI/Controls/SeparatorStyle.xaml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Controls/SliderStyle.xaml b/NeoUI/NeoUI/Controls/Slider.xaml
similarity index 74%
rename from NeoUI/NeoUI/Controls/SliderStyle.xaml
rename to NeoUI/NeoUI/Controls/Slider.xaml
index b44c8e8..4c5cb8b 100644
--- a/NeoUI/NeoUI/Controls/SliderStyle.xaml
+++ b/NeoUI/NeoUI/Controls/Slider.xaml
@@ -1,28 +1,28 @@
+ xmlns:internal="clr-namespace:NeoUI.Converters.Internal"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
+
+ UseLayoutRounding="True"
+ VerticalAlignment="Center">
+ Height="20"
+ StrokeThickness="1"
+ Width="20"
+ x:Name="grip">
+ Color="{DynamicResource DarkShadowColor}"
+ Opacity="0.4" />
@@ -30,36 +30,36 @@
-
+
+ ShadowDepth="3" />
-
-
-
+
+
+
-
+
+ SnapsToDevicePixels="True"
+ x:Name="border">
-
+
@@ -67,28 +67,29 @@
+ Visibility="Collapsed"
+ Width="4"
+ x:Name="TopTick" />
+ CornerRadius="4"
+ Grid.Column="1"
+ Grid.Row="0"
+ HorizontalAlignment="center"
+ Width="8"
+ x:Name="TrackBackground">
+ Width="8">
-
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
+ SnapsToDevicePixels="True"
+ x:Name="border">
@@ -205,28 +210,29 @@
+ Visibility="Collapsed"
+ x:Name="TopTick" />
+ x:Name="TrackBackground">
+ CornerRadius="4"
+ Height="8"
+ HorizontalAlignment="Left"
+ Margin="-1">
-
+
-
+
-
+
+ Template="{StaticResource DefaultSliderThumbTemplate}"
+ VerticalAlignment="Center"
+ Width="20"
+ x:Name="Thumb" />
+ Visibility="Collapsed"
+ x:Name="BottomTick" />
+ Grid.Column="1"
+ Grid.Row="1"
+ HorizontalAlignment="Center"
+ Margin="4,0,0,0"
+ Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, StringFormat=F1}"
+ VerticalAlignment="Center"
+ x:Name="ValueDisplay" />
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
@@ -326,10 +336,10 @@
-
+
-
+
diff --git a/NeoUI/NeoUI/Controls/SplashWindow/SplashWindow.xaml b/NeoUI/NeoUI/Controls/SplashWindow/SplashWindow.xaml
index 21e68ae..be32140 100644
--- a/NeoUI/NeoUI/Controls/SplashWindow/SplashWindow.xaml
+++ b/NeoUI/NeoUI/Controls/SplashWindow/SplashWindow.xaml
@@ -14,8 +14,8 @@
mc:Ignorable="d"
x:Class="NeoUI.Controls.SplashWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:NeoUI.Controls"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
diff --git a/NeoUI/NeoUI/Controls/StatusBarStyle.xaml b/NeoUI/NeoUI/Controls/StatusBar.xaml
similarity index 100%
rename from NeoUI/NeoUI/Controls/StatusBarStyle.xaml
rename to NeoUI/NeoUI/Controls/StatusBar.xaml
diff --git a/NeoUI/NeoUI/Controls/TabControl.xaml b/NeoUI/NeoUI/Controls/TabControl.xaml
index 9ec2220..e71fae7 100644
--- a/NeoUI/NeoUI/Controls/TabControl.xaml
+++ b/NeoUI/NeoUI/Controls/TabControl.xaml
@@ -5,7 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
-
-
-
-
-
-
+
-
+
diff --git a/NeoUI/NeoUI/Controls/TimePicker.xaml b/NeoUI/NeoUI/Controls/TimePicker.xaml
index 0944fbd..bd60694 100644
--- a/NeoUI/NeoUI/Controls/TimePicker.xaml
+++ b/NeoUI/NeoUI/Controls/TimePicker.xaml
@@ -1,12 +1,12 @@
+ xmlns:controls="clr-namespace:NeoUI.Controls"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Controls/WindowStyle.xaml.cs b/NeoUI/NeoUI/Controls/WindowStyle.xaml.cs
deleted file mode 100644
index 50fed67..0000000
--- a/NeoUI/NeoUI/Controls/WindowStyle.xaml.cs
+++ /dev/null
@@ -1,311 +0,0 @@
-using System.Windows.Automation.Peers;
-using System.Windows.Automation.Provider;
-using System.Windows.Input;
-
-using NeoUI.Assists;
-
-namespace NeoUI.Controls;
-
-///
-/// NeoWindow 类继承自 WPF 的 Window 类,用于创建具有特定样式和功能的窗口。
-/// 该类通过设置默认样式资源引用来自定义窗口外观,并提供属性来控制窗口的行为和内容布局。
-///
-public class NeoWindow : Window
-{
- private const string VbMinimizeButtonName = "minimizeButton";
- private const string VbMaximizeRestoreButtonName = "maximizeRestoreButton";
- ///
- /// 用于在XAML模板中标识关闭按钮的名称。
- /// 此常量字符串值为 "closeButton",用于在窗口样式应用时通过GetTemplateChild方法查找对应的关闭按钮控件。
- ///
- private const string VbCloseButtonName = "closeButton";
- ///
- ///
- ///
- public NeoWindow()
- {
- SetResourceReference(StyleProperty, typeof(NeoWindow)); //设置默认的样式资源引用
- //this.Deactivated += OnWindowDeactivated;
- //this.MouseLeave += OnWindowMouseLeave;
- }
- #region 自定义标题栏按钮行为
- //private Button? hoveredButton;
- //private Button? pressedButton;
- //protected override void OnSourceInitialized(EventArgs e)
- //{
- // base.OnSourceInitialized(e);
- // var source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
- // source?.AddHook(HwndSourceHook);
- //}
-
- /////
- ///// 处理窗口消息,用于命中测试和与自定义窗口按钮的鼠标交互。
- /////
- ///// 此方法处理特定的窗口消息,包括命中测试和鼠标按钮交互,
- ///// 以支持自定义窗口按钮行为。它会更新按钮状态(例如悬停、按下)并
- ///// 适当地引发自定义按钮的点击事件。
- ///// 接收消息的窗口句柄。
- ///// 消息标识符,例如命中测试或鼠标按钮事件。
- ///// 附加的特定于消息的信息。
- ///// 附加的特定于消息的信息,通常包含鼠标坐标。
- ///// 指示消息是否已被处理的值。如果消息已被处理,则设置为 ;
- ///// 否则为 。
- ///// 表示消息处理结果的 。对于命中测试消息返回命中测试结果,
- ///// 对于未处理的消息返回 。
- //private IntPtr HwndSourceHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
- //{
- // const int WM_NCHITTEST = 0x0084;
- // const int WM_NCLBUTTONDOWN = 0x00A1;
- // const int WM_NCLBUTTONUP = 0x00A2;
-
- // switch (msg)
- // {
- // case WM_NCHITTEST:
- // // 1. 进行命中测试,并获取鼠标下的按钮
- // HitTestResult hitTestResult = HitTestButton(PointFromScreen(new Point((short)(lParam.ToInt32() & 0xFFFF), (short)(lParam.ToInt32() >> 16))));
-
- // // 2. 更新悬停状态(内部会设置附加属性)
- // UpdateHoverState(hitTestResult.Button);
-
- // if (hitTestResult.Result != IntPtr.Zero)
- // {
- // handled = true;
- // return hitTestResult.Result;
- // }
- // break;
-
- // case WM_NCLBUTTONDOWN:
- // if (hoveredButton != null)
- // {
- // pressedButton = hoveredButton;
- // // 3. 设置状态为 Pressed
- // WindowAssist.SetWindowButtonState(pressedButton, WindowButtonState.Pressed);
- // handled = true;
- // }
- // break;
-
- // case WM_NCLBUTTONUP:
- // if (pressedButton != null)
- // {
- // // 4. 触发按钮的Click事件
- // if (pressedButton.IsEnabled)
- // {
- // pressedButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
- // }
-
- // // 5. 重置状态
- // Button previouslyPressedButton = pressedButton;
- // pressedButton = null;
- // // 检查鼠标是否仍在按钮上,以决定恢复到Hover还是Normal状态
- // UpdateHoverState(hoveredButton == previouslyPressedButton ? previouslyPressedButton : null);
- // handled = true;
- // }
- // break;
- // }
- // return IntPtr.Zero;
- //}
-
- /////
- ///// 更新悬停状态。
- /////
- /////
- //private void UpdateHoverState(Button? currentHoveredButton)
- //{
- // if (currentHoveredButton != hoveredButton)
- // {
- // // 离开旧按钮:如果之前有悬停的按钮,并且它当前不是"按下"状态,则恢复为"Normal"
- // if (hoveredButton != null && hoveredButton != pressedButton)
- // {
- // WindowAssist.SetWindowButtonState(hoveredButton, WindowButtonState.Normal);
- // }
-
- // hoveredButton = currentHoveredButton;
-
- // // 进入新按钮:如果现在有一个新的悬停按钮,并且它当前不是"按下"状态,则切换为"MouseOver"
- // if (hoveredButton != null && hoveredButton != pressedButton)
- // {
- // WindowAssist.SetWindowButtonState(hoveredButton, WindowButtonState.MouseOver);
- // }
- // }
- //}
-
- /////
- ///// 窗体失去焦点时,重置所有按钮状态。
- /////
- /////
- /////
- //private void OnWindowDeactivated(object? sender, EventArgs e) => ResetButtonStates();
- /////
- ///// 鼠标离开窗口时,重置所有按钮状态。
- /////
- /////
- /////
- //private void OnWindowMouseLeave(object sender, MouseEventArgs e) => ResetButtonStates();
- /////
- ///// 重置所有按钮的状态为 Normal。
- /////
- //private void ResetButtonStates()
- //{
- // if (pressedButton != null)
- // {
- // WindowAssist.SetWindowButtonState(pressedButton, WindowButtonState.Normal);
- // pressedButton = null;
- // }
- // UpdateHoverState(null);
- //}
-
- /////
- ///// 对窗口的标题栏按钮进行命中测试,确定鼠标位置是否在按钮上。
- /////
- /////
- /////
- //private HitTestResult HitTestButton(Point windowPos)
- //{
- // const int HTMINBUTTON = 8;
- // const int HTMAXBUTTON = 9;
- // const int HTCLOSE = 20;
-
- // if (closeButton != null && GetElementRect(closeButton).Contains(windowPos))
- // return new HitTestResult(new IntPtr(HTCLOSE), closeButton);
- // if (maximizeRestoreButton != null && GetElementRect(maximizeRestoreButton).Contains(windowPos))
- // return new HitTestResult(new IntPtr(HTMAXBUTTON), maximizeRestoreButton);
- // if (minimizeButton != null && GetElementRect(minimizeButton).Contains(windowPos))
- // return new HitTestResult(new IntPtr(HTMINBUTTON), minimizeButton);
-
- // return new HitTestResult(IntPtr.Zero, null);
- //}
- ///
- ///
- ///
- ///
- ///
- private Rect GetElementRect(FrameworkElement element)
- {
- if (element == null || element.ActualWidth == 0 || element.ActualHeight == 0 || !element.IsVisible)
- return Rect.Empty;
-
- try
- {
- var transform = element.TransformToAncestor(this);
- return transform.TransformBounds(new Rect(0, 0, element.ActualWidth, element.ActualHeight));
- }
- catch (Exception)
- {
- // 在窗口加载初期或某些极端情况下转换可能失败
- return Rect.Empty;
- }
- }
- #endregion
- static NeoWindow()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(NeoWindow), new FrameworkPropertyMetadata(typeof(NeoWindow)));
- }
- ///
- /// 如果窗口不活动,请让窗口的内容淡出。
- /// 默认值为真(已启用)。
- ///
- public static readonly DependencyProperty FadeContentIfInactiveProperty = DependencyProperty.Register(
- nameof(FadeContentIfInactive), typeof(bool), typeof(NeoWindow), new FrameworkPropertyMetadata(true));
-
- ///
- /// 如果窗口不活动,请让窗口的内容淡出。
- /// 默认值为真(已启用)。
- ///
- public bool FadeContentIfInactive
- {
- get => (bool)GetValue(FadeContentIfInactiveProperty);
-
- set => SetValue(FadeContentIfInactiveProperty, value);
- }
-
- ///
- /// 标题栏左侧内容模板
- ///
- public object TitleBarLeftContent
- {
- get => (object)GetValue(TitleBarLeftContentProperty);
- set => SetValue(TitleBarLeftContentProperty, value);
- }
-
- ///
- /// 用于定义窗口左侧内容区域的数据模板。
- /// 此依赖属性允许开发者自定义左侧内容的布局和显示方式,通过设置不同的DataTemplate来改变该区域的内容呈现形式。
- ///
- public static readonly DependencyProperty TitleBarLeftContentProperty =
- DependencyProperty.Register(nameof(TitleBarLeftContent), typeof(object), typeof(NeoWindow));
- ///
- /// 标题栏右侧内容模板
- ///
- public object TitleBarRightContent
- {
- get => (object)GetValue(TitleBarRightContentProperty);
- set => SetValue(TitleBarRightContentProperty, value);
- }
-
- ///
- /// 用于定义窗口右侧内容区域的数据模板。
- /// 此依赖属性允许开发者自定义右侧内容的布局和显示方式,通过设置不同的DataTemplate来改变该区域的内容呈现形式。
- ///
- public static readonly DependencyProperty TitleBarRightContentProperty =
- DependencyProperty.Register(nameof(TitleBarRightContent), typeof(object), typeof(NeoWindow));
- private Button? minimizeButton;
- private Button? maximizeRestoreButton;
- private Button? closeButton;
-
- ///
- public override void OnApplyTemplate()
- {
- if (minimizeButton != null)
- {
- minimizeButton.Click -= MinimizeButtonClickHandler;
- }
-
- minimizeButton = GetTemplateChild(VbMinimizeButtonName) as Button;
-
- if (minimizeButton != null)
- {
- minimizeButton.Click += MinimizeButtonClickHandler;
- }
-
- if (maximizeRestoreButton != null)
- {
- maximizeRestoreButton.Click -= MaximizeRestoreButtonClickHandler;
- }
-
- maximizeRestoreButton = GetTemplateChild(VbMaximizeRestoreButtonName) as Button;
-
- if (maximizeRestoreButton != null)
- {
- maximizeRestoreButton.Click += MaximizeRestoreButtonClickHandler;
- }
-
- if (closeButton != null)
- {
- closeButton.Click -= CloseButtonClickHandler;
- }
-
- closeButton = GetTemplateChild(VbCloseButtonName) as Button;
-
- if (closeButton != null)
- {
- closeButton.Click += CloseButtonClickHandler;
- }
-
- base.OnApplyTemplate();
- }
-
- private void CloseButtonClickHandler(object sender, RoutedEventArgs args)
- {
- Close();
- }
-
- private void MaximizeRestoreButtonClickHandler(object sender, RoutedEventArgs args)
- {
- WindowState = (WindowState == WindowState.Normal) ? WindowState.Maximized : WindowState.Normal;
- }
-
- private void MinimizeButtonClickHandler(object sender, RoutedEventArgs args)
- {
- WindowState = WindowState.Minimized;
- }
-}
diff --git a/NeoUI/NeoUI/Properties/AssemblyInfo.cs b/NeoUI/NeoUI/Properties/AssemblyInfo.cs
index 5f29c0f..17a12b1 100644
--- a/NeoUI/NeoUI/Properties/AssemblyInfo.cs
+++ b/NeoUI/NeoUI/Properties/AssemblyInfo.cs
@@ -27,4 +27,4 @@ using System.Windows.Markup;
[assembly: XmlnsDefinition("https://github.com/ShrlAlgo/NeoUI", "NeoUI.Controls.Decorations")]
[assembly: XmlnsDefinition("https://github.com/ShrlAlgo/NeoUI", "NeoUI.Layout")]
[assembly: XmlnsDefinition("https://github.com/ShrlAlgo/NeoUI", "NeoUI.Markup")]
-[assembly: XmlnsDefinition("https://github.com/ShrlAlgo/NeoUI", "NeoUI.Effects")]
\ No newline at end of file
+//[assembly: XmlnsDefinition("https://github.com/ShrlAlgo/NeoUI", "NeoUI.Effects")]
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Themes/Styles.xaml b/NeoUI/NeoUI/Themes/Styles.xaml
index 2abbd82..e0fc76a 100644
--- a/NeoUI/NeoUI/Themes/Styles.xaml
+++ b/NeoUI/NeoUI/Themes/Styles.xaml
@@ -1,5 +1,5 @@
-
+
@@ -17,37 +17,37 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
@@ -64,12 +64,12 @@
-
+
-
+
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Utilities/RelayCommand.cs b/NeoUI/NeoUI/Utilities/RelayCommand.cs
index 6ceeea6..b3eb1e7 100644
--- a/NeoUI/NeoUI/Utilities/RelayCommand.cs
+++ b/NeoUI/NeoUI/Utilities/RelayCommand.cs
@@ -6,7 +6,7 @@ namespace NeoUI.Utilities;
///
internal class RelayCommand : ICommand
{
- private readonly Action