diff --git a/src/Resources.props b/src/Resources.props
index 419ade94..1205f7e4 100644
--- a/src/Resources.props
+++ b/src/Resources.props
@@ -22,45 +22,16 @@
..\..\Reference\System.Windows.Interactivity.dll
+
WPFDevelopers.ico
-
- Resources\emoji\发烧.png
-
-
- Resources\emoji\大笑.png
-
-
- Resources\emoji\得意.png
-
-
- Resources\emoji\思考.png
-
-
- Resources\emoji\生病.png
-
-
- Resources\emoji\破涕为笑.png
-
-
- Resources\Assets\Lock.png
-
-
- Resources\Assets\Mail.png
+
+ Resources\emoji\%(Filename)%(Extension)
-
- Resources\Assets\User.png
-
-
- Resources\Assets\Clear.png
-
-
- Resources\Assets\Background.png
-
-
- Resources\Assets\Logo.png
+
+ Resources\Assets\%(Filename)%(Extension)
Resources\Fonts\fixedsys.ttf
@@ -71,77 +42,26 @@
Resources\Images\AnimationNavigationBar3D\background.png
-
- Resources\Images\Breathe\0.jpg
-
-
- Resources\Images\Breathe\1.jpg
-
-
- Resources\Images\Breathe\2.jpg
-
-
- Resources\Images\Chat\Left.jpg
-
-
- Resources\Images\Chat\Right.jpg
-
-
- Resources\Images\Chat\UserImages\jingtao.png
-
-
- Resources\Images\Chat\UserImages\yanjinhua.png
-
-
- Resources\Images\CircularMenu\1.png
-
-
- Resources\Images\CircularMenu\2.png
-
-
- Resources\Images\CircularMenu\3.png
-
-
- Resources\Images\CircularMenu\4.png
-
-
- Resources\Images\CircularMenu\5.png
-
-
- Resources\Images\CircularMenu\6.png
-
-
- Resources\Images\CircularMenu\7.png
-
-
- Resources\Images\CircularMenu\8.png
-
-
- Resources\Images\Craouse\0.jpg
-
-
- Resources\Images\Craouse\1.jpg
-
-
- Resources\Images\Craouse\2.jpg
-
-
- Resources\Images\Craouse\3.jpg
+
+ Resources\Images\Breathe\%(Filename)%(Extension)
-
- Resources\Images\Craouse\4.jpg
+
+ Resources\Images\Chat\%(Filename)%(Extension)
-
- Resources\Images\Crop\0.jpg
+
+ Resources\Images\Chat\UserImages\%(Filename)%(Extension)
-
- Resources\Images\Passwrod\Eye_50px.png
+
+ Resources\Images\CircleMenu\%(Filename)%(Extension)
-
- Resources\Images\Passwrod\Invisible_50px.png
+
+ Resources\Images\Craouse\%(Filename)%(Extension)
-
- Resources\Images\Passwrod\Lock_48px.png
+
+ Resources\Images\Crop\0.jpg
+
+
+ Resources\Images\Passwrod\%(Filename)%(Extension)
Resources\Images\Snow\SnowTree.png
diff --git a/src/TargetFrameworks.props b/src/TargetFrameworks.props
index 675ca381..797279f4 100644
--- a/src/TargetFrameworks.props
+++ b/src/TargetFrameworks.props
@@ -2,4 +2,39 @@
net45;net46;net47;net48;net5.0-windows;net6.0-windows;net7.0-windows;net8.0-windows;netcoreapp3.0
+
+
+ 7.0.0
+
+
+
+
+ 7.0.0
+
+
+
+
+ 7.0.0
+
+
+
+
+ 7.0.0
+
+
+
+
+ 7.0.0
+
+
+
+
+ 7.0.0
+
+
+
+
+ 7.0.0
+
+
\ No newline at end of file
diff --git a/src/WPFDevelopers.Net40/Themes/Generic.xaml b/src/WPFDevelopers.Net40/Themes/Generic.xaml
index 04a35980..7042df93 100644
--- a/src/WPFDevelopers.Net40/Themes/Generic.xaml
+++ b/src/WPFDevelopers.Net40/Themes/Generic.xaml
@@ -39,22 +39,142 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+ shell:WindowChrome.IsHitTestVisibleInChrome="True"
+ Orientation="Horizontal">
+
-
+
-
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Net40/Window.cs b/src/WPFDevelopers.Net40/Window.cs
index cb792f54..3f6e4189 100644
--- a/src/WPFDevelopers.Net40/Window.cs
+++ b/src/WPFDevelopers.Net40/Window.cs
@@ -2,16 +2,21 @@
using System;
using System.Runtime.InteropServices;
using System.Windows;
+using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
+using WPFDevelopers.Controls;
using WPFDevelopers.Helpers;
namespace WPFDevelopers.Net40
{
+ [TemplatePart(Name = TitleBarIcon, Type = typeof(Button))]
public class Window : System.Windows.Window
{
+ private const string TitleBarIcon = "PART_TitleBarIcon";
private WindowStyle _windowStyle;
+ private Button _titleBarIcon;
public static readonly DependencyProperty TitleHeightProperty =
DependencyProperty.Register("TitleHeight", typeof(double), typeof(Window), new PropertyMetadata(50d));
@@ -25,6 +30,9 @@ public class Window : System.Windows.Window
public static readonly DependencyProperty TitleBackgroundProperty =
DependencyProperty.Register("TitleBackground", typeof(Brush), typeof(Window), new PropertyMetadata(null));
+ public static readonly DependencyProperty TitleBarModeProperty =
+ DependencyProperty.Register("TitleBarMode", typeof(TitleBarMode), typeof(Window), new PropertyMetadata(TitleBarMode.Normal));
+
static Window()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata(typeof(Window)));
@@ -46,7 +54,20 @@ public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_windowStyle = WindowStyle;
+ _titleBarIcon = GetTemplateChild(TitleBarIcon) as Button;
+ if (_titleBarIcon != null)
+ {
+ _titleBarIcon.MouseDoubleClick -= Icon_MouseDoubleClick;
+ _titleBarIcon.MouseDoubleClick += Icon_MouseDoubleClick;
+ }
+ }
+
+ private void Icon_MouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ if (e.ChangedButton == MouseButton.Left)
+ Close();
}
+
public double TitleHeight
{
get => (double)GetValue(TitleHeightProperty);
@@ -71,10 +92,18 @@ public Brush TitleBackground
set => SetValue(TitleBackgroundProperty, value);
}
+ public TitleBarMode TitleBarMode
+ {
+ get => (TitleBarMode)GetValue(TitleBarModeProperty);
+ set => SetValue(TitleBarModeProperty, value);
+ }
+
private void Window_Loaded(object sender, RoutedEventArgs e)
{
hWnd = new WindowInteropHelper(this).Handle;
HwndSource.FromHwnd(hWnd).AddHook(WindowProc);
+ if(TitleBarMode == TitleBarMode.Normal)
+ TitleHeight = SystemParameters2.Current.WindowNonClientFrameThickness.Top;
}
protected override void OnContentRendered(EventArgs e)
diff --git a/src/WPFDevelopers.Net45x/Themes/Generic.xaml b/src/WPFDevelopers.Net45x/Themes/Generic.xaml
index b3e008ae..9c1840aa 100644
--- a/src/WPFDevelopers.Net45x/Themes/Generic.xaml
+++ b/src/WPFDevelopers.Net45x/Themes/Generic.xaml
@@ -45,22 +45,142 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
+
-
+
+ Visibility="Collapsed"
+ WindowChrome.ResizeGripDirection="BottomRight" />
+
+
+
+
-
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Net45x/WPFDevelopers.Net45x.csproj b/src/WPFDevelopers.Net45x/WPFDevelopers.Net45x.csproj
index f62c243d..9486cadf 100644
--- a/src/WPFDevelopers.Net45x/WPFDevelopers.Net45x.csproj
+++ b/src/WPFDevelopers.Net45x/WPFDevelopers.Net45x.csproj
@@ -18,39 +18,4 @@
-
-
- 7.0.0
-
-
-
-
- 7.0.0
-
-
-
-
- 7.0.0
-
-
-
-
- 7.0.0
-
-
-
-
- 7.0.0
-
-
-
-
- 7.0.0
-
-
-
-
- 7.0.0
-
-
\ No newline at end of file
diff --git a/src/WPFDevelopers.Net45x/Window.cs b/src/WPFDevelopers.Net45x/Window.cs
index 3e0b7ca4..fc6f039d 100644
--- a/src/WPFDevelopers.Net45x/Window.cs
+++ b/src/WPFDevelopers.Net45x/Window.cs
@@ -1,16 +1,23 @@
-using System;
+using Standard;
+using System;
+using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
+using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
+using WPFDevelopers.Controls;
using WPFDevelopers.Helpers;
namespace WPFDevelopers.Net45x
{
+ [TemplatePart(Name = TitleBarIcon, Type = typeof(Button))]
public class Window : System.Windows.Window
{
+ private const string TitleBarIcon = "PART_TitleBarIcon";
private WindowStyle _windowStyle;
+ private Button _titleBarIcon;
public static readonly DependencyProperty TitleHeightProperty =
DependencyProperty.Register("TitleHeight", typeof(double), typeof(Window), new PropertyMetadata(50d));
@@ -24,6 +31,9 @@ public class Window : System.Windows.Window
public static readonly DependencyProperty TitleBackgroundProperty =
DependencyProperty.Register("TitleBackground", typeof(Brush), typeof(Window), new PropertyMetadata(null));
+ public static readonly DependencyProperty TitleBarModeProperty =
+ DependencyProperty.Register("TitleBarMode", typeof(TitleBarMode), typeof(Window), new PropertyMetadata(TitleBarMode.Normal));
+
static Window()
{
StyleProperty.OverrideMetadata(typeof(Window),
@@ -45,28 +55,50 @@ public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_windowStyle = WindowStyle;
+ _titleBarIcon = GetTemplateChild(TitleBarIcon) as Button;
+ if (_titleBarIcon != null)
+ {
+ _titleBarIcon.MouseDoubleClick -= Icon_MouseDoubleClick;
+ _titleBarIcon.MouseDoubleClick += Icon_MouseDoubleClick;
+ }
}
+
+ private void Icon_MouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ if (e.ChangedButton == MouseButton.Left)
+ Close();
+ }
+
public double TitleHeight
{
get => (double)GetValue(TitleHeightProperty);
set => SetValue(TitleHeightProperty, value);
}
+
public bool NoChrome
{
get => (bool)GetValue(NoChromeProperty);
set => SetValue(NoChromeProperty, value);
}
+
public object TitleBar
{
get => (object)GetValue(TitleBarProperty);
set => SetValue(TitleBarProperty, value);
}
+
public Brush TitleBackground
{
get => (Brush)GetValue(TitleBackgroundProperty);
set => SetValue(TitleBackgroundProperty, value);
}
+ public TitleBarMode TitleBarMode
+ {
+ get => (TitleBarMode)GetValue(TitleBarModeProperty);
+ set => SetValue(TitleBarModeProperty, value);
+ }
+
private static T GetResourceKey(string key)
{
if (Application.Current.TryFindResource(key) is T resource) return resource;
@@ -78,6 +110,8 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
{
hWnd = new WindowInteropHelper(this).Handle;
HwndSource.FromHwnd(hWnd).AddHook(WindowProc);
+ if (TitleBarMode == TitleBarMode.Normal)
+ TitleHeight = SystemParameters.WindowNonClientFrameThickness.Top + SystemParameters.WindowResizeBorderThickness.Top; //32;//SystemParameters.WindowNonClientFrameThickness.Top;
}
protected override void OnContentRendered(EventArgs e)
@@ -171,4 +205,5 @@ private void ShowSystemMenu(object sender, ExecutedRoutedEventArgs e)
#endregion
}
+
}
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/ChatEmoji/ChatEmoji.cs b/src/WPFDevelopers.Samples.Shared/Controls/ChatEmoji/ChatEmoji.cs
index 402a96a6..a1363adb 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/ChatEmoji/ChatEmoji.cs
+++ b/src/WPFDevelopers.Samples.Shared/Controls/ChatEmoji/ChatEmoji.cs
@@ -122,7 +122,7 @@ private void UpdateIsRight()
rightWrapPanel == null) return;
if (!IsRight)
{
- m_textBlock.Foreground = Brushes.White;
+ //m_textBlock.Foreground = Brushes.White;
leftWrapPanel.Visibility = Visibility.Visible;
border.Background = ControlsHelper.Brush;
rightWrapPanel.Visibility = Visibility.Collapsed;
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/BasicControlsExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/BasicControlsExample.xaml
index f19d30d8..644fae3f 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/BasicControlsExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/BasicControlsExample.xaml
@@ -71,6 +71,21 @@
Unchecked="LightDark_Checked" />
+
+
+
+
+ 中文
+ English
+ 한국어
+
+
-
+
+
+
+
+
+
+
+
-
-
+
+
@@ -764,32 +790,64 @@
-
+
-
+
-
+
-
+
-
+
+
+
+
-
+
-
+
-
+
@@ -797,13 +855,22 @@
Margin="4"
IsEnabled="False"
TabStripPlacement="Right">
-
+
-
+
-
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/BasicControlsExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/BasicControlsExample.xaml.cs
index c9563d50..9ce55f3f 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/BasicControlsExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/BasicControlsExample.xaml.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
+using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -241,5 +242,19 @@ private void ButtonNone_Click(object sender, RoutedEventArgs e)
{
new NoneNoChromeWindow().Show();
}
+
+ private void ComboBoxLanguages_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ var cBox = sender as ComboBox;
+ if (cBox != null)
+ {
+ var item = cBox.SelectedItem as ComboBoxItem;
+ var tag = item.Tag.ToString();
+ if (item != null && LanguageManager.Instance.CurrentCulture.Name != tag)
+ {
+ LanguageManager.Instance.ChangeLanguage(new CultureInfo(tag));
+ }
+ }
+ }
}
}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/CircleMenuExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/CircleMenuExample.xaml
new file mode 100644
index 00000000..807291af
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/CircleMenuExample.xaml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/CircularMenuExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/CircleMenuExample.xaml.cs
similarity index 72%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/CircularMenuExample.xaml.cs
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/CircleMenuExample.xaml.cs
index 4aaa78dd..740d358c 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/CircularMenuExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/CircleMenuExample.xaml.cs
@@ -11,9 +11,9 @@
namespace WPFDevelopers.Samples.ExampleViews
{
///
- /// CircularMenuExample.xaml 的交互逻辑
+ /// CircleMenuExample.xaml 的交互逻辑
///
- public partial class CircularMenuExample : UserControl
+ public partial class CircleMenuExample : UserControl
{
public IEnumerable MenuArray
{
@@ -22,8 +22,8 @@ public IEnumerable MenuArray
}
public static readonly DependencyProperty MenuArrayProperty =
- DependencyProperty.Register("MenuArray", typeof(IEnumerable), typeof(MainWindow), new PropertyMetadata(null));
- public CircularMenuExample()
+ DependencyProperty.Register("MenuArray", typeof(IEnumerable), typeof(CircleMenuExample), new PropertyMetadata(null));
+ public CircleMenuExample()
{
InitializeComponent();
@@ -31,16 +31,16 @@ public CircularMenuExample()
var menuItemModels = new List();
for (int i = 1; i <= 8; i++)
{
- menuItemModels.Add(new MenuItemModel { Angle = angle, Title = $"菜单{i}", IconImage = new BitmapImage(new Uri($"pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircularMenu/{i}.png")) });
+ menuItemModels.Add(new MenuItemModel { Angle = angle, Title = $"菜单{i}", IconImage = new BitmapImage(new Uri($"pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircleMenu/{i}.png")) });
angle += 45;
}
MenuArray = menuItemModels;
}
- private void CircularMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ private void CircleMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- var circularMenu = sender as CircularMenu;
- MenuItemModel menuItemModel = circularMenu.SelectedItem as MenuItemModel;
+ var circularMenu = sender as CircleMenu;
+ var menuItemModel = circularMenu.SelectedItem as MenuItemModel;
MessageBox.Show($"点击了{menuItemModel.Title}");
}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/CircleProgressBarExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/CircleProgressBarExample.xaml
new file mode 100644
index 00000000..c7a319e3
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/CircleProgressBarExample.xaml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/CircleProgressBarExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/CircleProgressBarExample.xaml.cs
new file mode 100644
index 00000000..c6b6ca8b
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/CircleProgressBarExample.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace WPFDevelopers.Samples.ExampleViews
+{
+ ///
+ /// CircleProgressBarExample.xaml 的交互逻辑
+ ///
+ public partial class CircleProgressBarExample : UserControl
+ {
+ public CircleProgressBarExample()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/CircularMenuExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/CircularMenuExample.xaml
deleted file mode 100644
index 854f13d5..00000000
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/CircularMenuExample.xaml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/CircularProgressBarExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/CircularProgressBarExample.xaml
deleted file mode 100644
index 7b8f195d..00000000
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/CircularProgressBarExample.xaml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/CircularProgressBarExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/CircularProgressBarExample.xaml.cs
deleted file mode 100644
index d329787b..00000000
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/CircularProgressBarExample.xaml.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-
-namespace WPFDevelopers.Samples.ExampleViews
-{
- ///
- /// CircularProgressBarExample.xaml 的交互逻辑
- ///
- public partial class CircularProgressBarExample : UserControl
- {
- public CircularProgressBarExample()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/DateRangePickerExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/DateRangePickerExample.xaml
index cef95d18..f5614b32 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/DateRangePickerExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/DateRangePickerExample.xaml
@@ -19,8 +19,6 @@
EndWatermark="结束日期"
StartWatermark="开始日期" />
-
+
-
+
-
+
-
+
-
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/DrawerMenu/DrawerMenuExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/DrawerMenu/DrawerMenuExample.xaml.cs
index 2b81fad0..43212ae8 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/DrawerMenu/DrawerMenuExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/DrawerMenu/DrawerMenuExample.xaml.cs
@@ -33,9 +33,9 @@ public DrawerMenuExample()
{
InitializeComponent();
var items = new List();
- items.Add(new DrawerMenuItem { Text = "Menu01", Icon = new Image() { Source = new BitmapImage(new Uri($"pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircularMenu/1.png")) } });
- items.Add(new DrawerMenuItem { Text = "Menu02", Icon = new Image() { Source = new BitmapImage(new Uri($"pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircularMenu/2.png")) } });
- items.Add(new DrawerMenuItem { Text = "Menu03", Icon = new Image() { Source = new BitmapImage(new Uri($"pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircularMenu/3.png")) } });
+ items.Add(new DrawerMenuItem { Text = "Menu01", Icon = new Image() { Source = new BitmapImage(new Uri($"pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircleMenu/1.png")) } });
+ items.Add(new DrawerMenuItem { Text = "Menu02", Icon = new Image() { Source = new BitmapImage(new Uri($"pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircleMenu/2.png")) } });
+ items.Add(new DrawerMenuItem { Text = "Menu03", Icon = new Image() { Source = new BitmapImage(new Uri($"pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/CircleMenu/3.png")) } });
DrawerMenuItems = items;
}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/GaugeExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/GaugeExample.xaml
new file mode 100644
index 00000000..8d8719b3
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/GaugeExample.xaml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/GaugeExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/GaugeExample.xaml.cs
new file mode 100644
index 00000000..c142337f
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/GaugeExample.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace WPFDevelopers.Samples.ExampleViews
+{
+ ///
+ /// GaugeExample.xaml 的交互逻辑
+ ///
+ public partial class GaugeExample : UserControl
+ {
+ public GaugeExample()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml
index da86b6c0..e202e5fa 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml
@@ -16,6 +16,7 @@
Width="{x:Static local:App.Wdith}"
Height="{x:Static local:App.Height}"
Icon="pack://application:,,,/WPFDevelopers.Samples;component/WPFDevelopers.ico"
+ TitleBarMode="HighTitleBar"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/MessageExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/MessageExample.xaml
index 1ffce860..d65b3c93 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/MessageExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/MessageExample.xaml
@@ -11,37 +11,89 @@
d:DesignWidth="800"
mc:Ignorable="d">
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/MessageExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/MessageExample.xaml.cs
index 3036cbe9..3d604e0f 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/MessageExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/MessageExample.xaml.cs
@@ -1,4 +1,5 @@
-using System.Windows;
+using System;
+using System.Windows;
using System.Windows.Controls;
using WPFDevelopers.Controls;
@@ -12,6 +13,17 @@ public partial class MessageExample : UserControl
public MessageExample()
{
InitializeComponent();
+
+ }
+
+ private void RadioButton_Checked(object sender, RoutedEventArgs e)
+ {
+ var radioButton = sender as RadioButton;
+ if (radioButton != null)
+ {
+ if (Enum.TryParse(radioButton.Content.ToString(), out Position position))
+ Message.SetPosition(position);
+ }
}
private void AddButton_Click(object sender, RoutedEventArgs e)
{
@@ -34,7 +46,38 @@ private void AddButton_Click(object sender, RoutedEventArgs e)
Message.Push("这是一条很长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长消息", MessageBoxImage.Information);
break;
}
+ }
+ private void BtnClear_Click(object sender, RoutedEventArgs e)
+ {
+ Message.Clear();
+ }
+ private void BtnDesktopClear_Click(object sender, RoutedEventArgs e)
+ {
+ Message.ClearDesktop();
+ }
+
+ private void AddButtonDesktop_Click(object sender, RoutedEventArgs e)
+ {
+ var btn = sender as Button;
+ switch (btn.Tag)
+ {
+ case "Info":
+ Message.PushDesktop("This is a info message", MessageBoxImage.Information);
+ break;
+ case "Error":
+ Message.PushDesktop("This is a error message", MessageBoxImage.Error, true);
+ break;
+ case "Warning":
+ Message.PushDesktop("This is a warning message", MessageBoxImage.Warning, true);
+ break;
+ case "Question":
+ Message.PushDesktop("This is a question message", MessageBoxImage.Question);
+ break;
+ default:
+ Message.PushDesktop("这是一条很长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长消息", MessageBoxImage.Information);
+ break;
+ }
}
}
}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectComboBoxExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectComboBoxExample.xaml
index 3496b003..bdde174d 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectComboBoxExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectComboBoxExample.xaml
@@ -34,9 +34,8 @@
Rows="2">
Option 1
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectSearchComboBoxExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectSearchComboBoxExample.xaml
index 9be76a4c..accea93d 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectSearchComboBoxExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectSearchComboBoxExample.xaml
@@ -16,74 +16,83 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
+ VerticalAlignment="Top"
+ wd:PanelHelper.Spacing="3"
+ Orientation="Horizontal">
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectSearchComboBoxExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectSearchComboBoxExample.xaml.cs
index e31d6848..419d53fc 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectSearchComboBoxExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectSearchComboBoxExample.xaml.cs
@@ -1,5 +1,5 @@
-using ICSharpCode.AvalonEdit.Document;
-using System.Collections.Generic;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
@@ -11,6 +11,24 @@ namespace WPFDevelopers.Samples.ExampleViews
///
public partial class MultiSelectSearchComboBoxExample : UserControl
{
+ public ObservableCollection SelectedItems
+ {
+ get { return (ObservableCollection)GetValue(SelectedItemsProperty); }
+ set { SetValue(SelectedItemsProperty, value); }
+ }
+
+ public static readonly DependencyProperty SelectedItemsProperty =
+ DependencyProperty.Register("SelectedItems", typeof(ObservableCollection), typeof(MultiSelectSearchComboBoxExample), new PropertyMetadata(null));
+
+ public ObservableCollection ItemsSource
+ {
+ get { return (ObservableCollection)GetValue(ItemsSourceProperty); }
+ set { SetValue(ItemsSourceProperty, value); }
+ }
+
+ public static readonly DependencyProperty ItemsSourceProperty =
+ DependencyProperty.Register("ItemsSource", typeof(ObservableCollection), typeof(MultiSelectSearchComboBoxExample), new PropertyMetadata(null));
+
public MultiSelectSearchComboBoxExample()
{
InitializeComponent();
@@ -19,11 +37,11 @@ public MultiSelectSearchComboBoxExample()
private void MultiSelectSearchComboBoxExample_Loaded(object sender, RoutedEventArgs e)
{
- var list = new List();
- for (int i = 0; i < 10; i++)
- list.Add(i.ToString());
- MyMultiSelectionSearchComboBox2.ItemsSource = list;
- MyMultiSelectionSearchComboBox2.SelectedItems = list.Skip(3).ToList();
+ //var list = new List();
+ //for (int i = 0; i < 10; i++)
+ // list.Add(i.ToString());
+ //MyMultiSelectionSearchComboBox2.ItemsSource = list;
+ //MyMultiSelectionSearchComboBox2.SelectedItems = list.Skip(3).ToList();
var list2 = new List();
list2.Add(new UserInfo() { ID = "0", Name = "343DST.com" });
@@ -32,11 +50,19 @@ private void MultiSelectSearchComboBoxExample_Loaded(object sender, RoutedEventA
list2.Add(new UserInfo() { ID = "3", Name = "josh.peng" });
MyMultiSelectionSearchComboBox3.ItemsSource = list2;
MyMultiSelectionSearchComboBox3.SelectedItems = list2.Where(x => x.ID == "1" || x.ID == "3").ToList();
+
+ ItemsSource = new ObservableCollection(list2);
+ SelectedItems = new ObservableCollection(list2.Where(x => x.ID == "1" || x.ID == "3"));
}
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
- WPFDevelopers.Controls.MessageBox.Show($"{MyMultiSelectionSearchComboBox2.Text} \r\n总共选中:{MyMultiSelectionSearchComboBox2.SelectedItems.Count} 条","选中内容",MessageBoxButton.OK,MessageBoxImage.Information);
+ WPFDevelopers.Controls.MessageBox.Show($"{MyMultiSelectionSearchComboBox2.Text} \r\n总共选中:{SelectedItems.Count} 条", "选中内容", MessageBoxButton.OK, MessageBoxImage.Information);
+ }
+
+ private void BtnAdd_Click(object sender, System.Windows.RoutedEventArgs e)
+ {
+ ItemsSource.Add(new UserInfo() { ID = "4", Name = "OpenAI.com" });
}
}
public class UserInfo
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/PanningItemsExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/PanningItemsExample.xaml.cs
index a9cf3f9f..3b1a801e 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/PanningItemsExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/PanningItemsExample.xaml.cs
@@ -1,16 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
+using System.Windows.Controls;
namespace WPFDevelopers.Samples.ExampleViews
{
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml
index b9552223..1b30541c 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml
@@ -1,47 +1,86 @@
-
+
-
+ Value="40" />
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml.cs
index 04c17dd8..9decfc70 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml.cs
@@ -1,16 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
+using System.Windows.Controls;
namespace WPFDevelopers.Samples.ExampleViews
{
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/ScreenCutExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/ScreenCutExample.xaml.cs
index 97c4a133..7ec5538c 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/ScreenCutExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/ScreenCutExample.xaml.cs
@@ -4,6 +4,7 @@
using System.Windows.Controls;
using WPFDevelopers.Controls;
using WPFDevelopers.Controls.ScreenCapturer;
+using static System.Net.Mime.MediaTypeNames;
namespace WPFDevelopers.Samples.ExampleViews
{
@@ -50,11 +51,17 @@ private void Button_Click(object sender, RoutedEventArgs e)
screenCapturer = new ScreenCapture();
screenCapturer.SnapCompleted += ScreenCapturer_SnapCompleted;
screenCapturer.SnapCanceled += ScreenCapturer_SnapCanceled;
+ screenCapturer.SnapSaveFullPath += ScreenCapturer_SnapSaveFullPath;
screenCapturer.Capture();
}));
}
+ private void ScreenCapturer_SnapSaveFullPath(string text)
+ {
+ WPFDevelopers.Controls.MessageBox.Show($"截图路径:{text}","Info",MessageBoxImage.Information);
+ }
+
private void ScreenCapturer_SnapCanceled()
{
App.CurrentMainWindow.WindowState = WindowState.Normal;
@@ -76,6 +83,12 @@ private void ButtonExt_Click(object sender, RoutedEventArgs e)
var screenCaptureExt = new ScreenCaptureExt();
screenCaptureExt.SnapCanceled += ScreenCaptureExt_SnapCanceled;
screenCaptureExt.SnapCompleted += ScreenCaptureExt_SnapCompleted;
+ screenCaptureExt.SnapSaveFullPath += ScreenCaptureExt_SnapSaveFullPath;
+ }
+
+ private void ScreenCaptureExt_SnapSaveFullPath(string text)
+ {
+ Message.Push($"截图路径:{text}", MessageBoxImage.Information);
}
private void ScreenCaptureExt_SnapCompleted(System.Windows.Media.Imaging.BitmapSource bitmap)
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/ThermometerExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/ThermometerExample.xaml
index f7e56d9b..1f85ef7d 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/ThermometerExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/ThermometerExample.xaml
@@ -1,52 +1,58 @@
-
+
-
+
-
-
+
+
-
-
-
-
+
+
+
+
-
+
-
-
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/HighTitleBarWindow.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/HighTitleBarWindow.xaml
new file mode 100644
index 00000000..255ede9e
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/HighTitleBarWindow.xaml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/HighTitleBarWindow.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/HighTitleBarWindow.xaml.cs
new file mode 100644
index 00000000..400e2d6e
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/HighTitleBarWindow.xaml.cs
@@ -0,0 +1,13 @@
+namespace WPFDevelopers.Samples.ExampleViews
+{
+ ///
+ /// HighTitleBarWindow.xaml 的交互逻辑
+ ///
+ public partial class HighTitleBarWindow
+ {
+ public HighTitleBarWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/NoChromeWindow.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NoChromeWindow.xaml
similarity index 90%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/NoChromeWindow.xaml
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NoChromeWindow.xaml
index 9ae4507c..bd9a4560 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/NoChromeWindow.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NoChromeWindow.xaml
@@ -7,13 +7,14 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
Title="NoChromeWindow"
- Width="400"
- Height="300"
+ Width="710"
+ Height="520"
BorderBrush="Transparent"
BorderThickness="0"
NoChrome="True"
ResizeMode="NoResize"
TitleBackground="{DynamicResource WD.BackgroundSolidColorBrush}"
+ TitleBarMode="HighTitleBar"
TitleHeight="30"
WindowStartupLocation="CenterScreen"
WindowStyle="ToolWindow"
@@ -56,8 +57,8 @@
Text="Content" />
-
-
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/NoChromeWindow.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NoChromeWindow.xaml.cs
similarity index 88%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/NoChromeWindow.xaml.cs
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NoChromeWindow.xaml.cs
index 7f2c948f..bb36d33e 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/NoChromeWindow.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NoChromeWindow.xaml.cs
@@ -3,7 +3,7 @@
namespace WPFDevelopers.Samples.ExampleViews
{
///
- /// Window1.xaml 的交互逻辑
+ /// NoChromeWindow.xaml 的交互逻辑
///
public partial class NoChromeWindow
{
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/NoneNoChromeWindow.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NoneNoChromeWindow.xaml
similarity index 91%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/NoneNoChromeWindow.xaml
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NoneNoChromeWindow.xaml
index 5020739e..90033573 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/NoneNoChromeWindow.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NoneNoChromeWindow.xaml
@@ -7,12 +7,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
Title="NoChromeWindow"
- Width="400"
- Height="300"
+ Width="710"
+ Height="520"
BorderBrush="{StaticResource WD.DangerSolidColorBrush}"
BorderThickness="1"
NoChrome="True"
TitleBackground="{StaticResource WD.DangerSolidColorBrush}"
+ TitleBarMode="HighTitleBar"
TitleHeight="30"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
@@ -57,8 +58,8 @@
Text="Content" />
-
-
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/NoneNoChromeWindow.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NoneNoChromeWindow.xaml.cs
similarity index 87%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/NoneNoChromeWindow.xaml.cs
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NoneNoChromeWindow.xaml.cs
index 91b3b2c9..28d0c1f5 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/NoneNoChromeWindow.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NoneNoChromeWindow.xaml.cs
@@ -3,7 +3,7 @@
namespace WPFDevelopers.Samples.ExampleViews
{
///
- /// Window1.xaml 的交互逻辑
+ /// NoneNoChromeWindow.xaml 的交互逻辑
///
public partial class NoneNoChromeWindow
{
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml
new file mode 100644
index 00000000..8bcd666a
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml.cs
new file mode 100644
index 00000000..5673fc64
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml.cs
@@ -0,0 +1,14 @@
+
+namespace WPFDevelopers.Samples.ExampleViews
+{
+ ///
+ /// NormalWindow.xaml 的交互逻辑
+ ///
+ public partial class NormalWindow
+ {
+ public NormalWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml
new file mode 100644
index 00000000..e4d90e0c
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml.cs
new file mode 100644
index 00000000..6deb894b
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml.cs
@@ -0,0 +1,35 @@
+using System.Windows;
+using System.Windows.Controls;
+using WPFDevelopers.Helpers;
+
+namespace WPFDevelopers.Samples.ExampleViews
+{
+ ///
+ /// WindowExample.xaml 的交互逻辑
+ ///
+ public partial class WindowExample : UserControl
+ {
+ public WindowExample()
+ {
+ InitializeComponent();
+ }
+
+ private void BtnHighTitleBar_Click(object sender, RoutedEventArgs e)
+ {
+ new HighTitleBarWindow().MaskShowDialog();
+ }
+ private void BtnNormal_Click(object sender, RoutedEventArgs e)
+ {
+ new NormalWindow().MaskShowDialog();
+ }
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ new NoChromeWindow().MaskShowDialog();
+ }
+
+ private void ButtonNone_Click(object sender, RoutedEventArgs e)
+ {
+ new NoneNoChromeWindow().MaskShowDialog();
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Samples.Shared/Helpers/MenuEnum.cs b/src/WPFDevelopers.Samples.Shared/Helpers/MenuEnum.cs
index a02b745d..11e00581 100644
--- a/src/WPFDevelopers.Samples.Shared/Helpers/MenuEnum.cs
+++ b/src/WPFDevelopers.Samples.Shared/Helpers/MenuEnum.cs
@@ -17,14 +17,16 @@ public enum MenuEnum
CycleLoading,
RollLoading,
CutImage,
+ //CutImage,
+ Window,
CropAvatar,
AnimationAudio,
AMap,
TransformLayout,
VerifyCode,
- CircularMenu,
+ CircleMenu,
ChatEmoji,
- ProgressBar,
+ CircleProgressBar,
Dashboard,
PieControl,
Password,
@@ -87,6 +89,7 @@ public enum MenuEnum
Spacing,
Drawer,
DateRangePicker,
+ Gauge,
VirtualizingWrapPanel,
AcrylicBlur,
TaskbarInfo
diff --git a/src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/1.png b/src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/1.png
similarity index 100%
rename from src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/1.png
rename to src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/1.png
diff --git a/src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/2.png b/src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/2.png
similarity index 100%
rename from src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/2.png
rename to src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/2.png
diff --git a/src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/3.png b/src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/3.png
similarity index 100%
rename from src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/3.png
rename to src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/3.png
diff --git a/src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/4.png b/src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/4.png
similarity index 100%
rename from src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/4.png
rename to src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/4.png
diff --git a/src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/5.png b/src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/5.png
similarity index 100%
rename from src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/5.png
rename to src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/5.png
diff --git a/src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/6.png b/src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/6.png
similarity index 100%
rename from src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/6.png
rename to src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/6.png
diff --git a/src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/7.png b/src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/7.png
similarity index 100%
rename from src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/7.png
rename to src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/7.png
diff --git a/src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/8.png b/src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/8.png
similarity index 100%
rename from src/WPFDevelopers.Samples.Shared/Resources/Images/CircularMenu/8.png
rename to src/WPFDevelopers.Samples.Shared/Resources/Images/CircleMenu/8.png
diff --git a/src/WPFDevelopers.Samples.Shared/ViewModels/MainVM.cs b/src/WPFDevelopers.Samples.Shared/ViewModels/MainVM.cs
index 01920894..27eda91e 100644
--- a/src/WPFDevelopers.Samples.Shared/ViewModels/MainVM.cs
+++ b/src/WPFDevelopers.Samples.Shared/ViewModels/MainVM.cs
@@ -142,8 +142,11 @@ void MenuItemSelection(string _menuName)
case MenuEnum.RollLoading:
ControlPanel = new RollLoadingExample();
break;
- case MenuEnum.CutImage:
- ControlPanel = new CutImageExample();
+ //case MenuEnum.CutImage:
+ // ControlPanel = new CutImageExample();
+ // break;
+ case MenuEnum.Window:
+ ControlPanel = new WindowExample();
break;
case MenuEnum.CropAvatar:
ControlPanel = new CropAvatarExample();
@@ -160,8 +163,8 @@ void MenuItemSelection(string _menuName)
case MenuEnum.VerifyCode:
ControlPanel = new VerifyCodeExample();
break;
- case MenuEnum.CircularMenu:
- ControlPanel = new CircularMenuExample();
+ case MenuEnum.CircleMenu:
+ ControlPanel = new CircleMenuExample();
break;
case MenuEnum.BreatheLight:
ControlPanel = new BreatheLightExample();
@@ -170,8 +173,8 @@ void MenuItemSelection(string _menuName)
case MenuEnum.ChatEmoji:
ControlPanel = new ChatEmojiExample();
break;
- case MenuEnum.ProgressBar:
- ControlPanel = new CircularProgressBarExample();
+ case MenuEnum.CircleProgressBar:
+ ControlPanel = new CircleProgressBarExample();
break;
case MenuEnum.Dashboard:
ControlPanel = new DashboardExample();
@@ -364,6 +367,9 @@ void MenuItemSelection(string _menuName)
case MenuEnum.DateRangePicker:
ControlPanel = new DateRangePickerExample();
break;
+ case MenuEnum.Gauge:
+ ControlPanel = new GaugeExample();
+ break;
case MenuEnum.VirtualizingWrapPanel:
ControlPanel = new VirtualizingWrapPanel();
new VirtualizingWrapPanelExample().MaskShowDialog();
diff --git a/src/WPFDevelopers.Samples.Shared/WPFDevelopers.Samples.Shared.projitems b/src/WPFDevelopers.Samples.Shared/WPFDevelopers.Samples.Shared.projitems
index 07c1fd1d..40fb2871 100644
--- a/src/WPFDevelopers.Samples.Shared/WPFDevelopers.Samples.Shared.projitems
+++ b/src/WPFDevelopers.Samples.Shared/WPFDevelopers.Samples.Shared.projitems
@@ -115,13 +115,13 @@
Code
ChatEmojiExample.xaml
-
+
Code
- CircularMenuExample.xaml
+ CircleMenuExample.xaml
-
+
Code
- CircularProgressBarExample.xaml
+ CircleProgressBarExample.xaml
ColorPickerExample.xaml
@@ -207,6 +207,9 @@
Code
EdgeLightExample.xaml
+
+ GaugeExample.xaml
+
IPEditBoxExample.xaml
@@ -297,10 +300,13 @@
Code
MultiSelectSearchComboBoxExample.xaml
-
+
+ HighTitleBarWindow.xaml
+
+
NoChromeWindow.xaml
-
+
NoneNoChromeWindow.xaml
@@ -455,6 +461,12 @@
WaterfallPanelExample.xaml
+
+ NormalWindow.xaml
+
+
+ WindowExample.xaml
+
Code
VolumeControl.xaml
@@ -612,11 +624,11 @@
MSBuild:Compile
Designer
-
+
MSBuild:Compile
Designer
-
+
MSBuild:Compile
Designer
@@ -704,6 +716,10 @@
MSBuild:Compile
Designer
+
+ MSBuild:Compile
+ Designer
+
MSBuild:Compile
Designer
@@ -813,11 +829,15 @@
MSBuild:Compile
Designer
-
+
+ MSBuild:Compile
+ Designer
+
+
MSBuild:Compile
Designer
-
+
MSBuild:Compile
Designer
@@ -977,6 +997,14 @@
MSBuild:Compile
Designer
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
MSBuild:Compile
Designer
diff --git a/src/WPFDevelopers.SamplesCode/WPFDevelopers.SamplesCode.csproj b/src/WPFDevelopers.SamplesCode/WPFDevelopers.SamplesCode.csproj
index 6abeaa6e..20ec7fcc 100644
--- a/src/WPFDevelopers.SamplesCode/WPFDevelopers.SamplesCode.csproj
+++ b/src/WPFDevelopers.SamplesCode/WPFDevelopers.SamplesCode.csproj
@@ -24,8 +24,8 @@
-
-
+
+
@@ -134,8 +134,8 @@
-
-
+
+
@@ -150,6 +150,9 @@
+
+
+
@@ -191,11 +194,11 @@
ExampleViews\ChatEmojiExample.xaml
-
- ExampleViews\CircularMenuExample.xaml
+
+ ExampleViews\CircleMenuExample.xaml
-
- ExampleViews\CircularProgressBarExample.xaml
+
+ ExampleViews\CircleProgressBarExample.xaml
ExampleViews\CountdownTimerExample.xaml
@@ -467,11 +470,11 @@
ExampleViews\MessageExample.xaml
-
- ExampleViews\NoChromeWindow.xaml
+
+ ExampleViews\Window\NoChromeWindow.xaml
-
- ExampleViews\NoneNoChromeWindow.xaml
+
+ ExampleViews\Window\NoneNoChromeWindow.xaml
ExampleViews\PathIconExample.xaml
@@ -512,5 +515,14 @@
ExampleViews\NotifyIconExample.xaml
+
+ ExampleViews\GaugeExample.xaml
+
+
+ ExampleViews\Window\HighTitleBarWindow.xaml
+
+
+ ExampleViews\Window\NormalWindow.xaml
+
diff --git a/src/WPFDevelopers.Shared/Controls/BaseControls/ScaleBase.cs b/src/WPFDevelopers.Shared/Controls/BaseControls/ScaleBase.cs
new file mode 100644
index 00000000..8786cb74
--- /dev/null
+++ b/src/WPFDevelopers.Shared/Controls/BaseControls/ScaleBase.cs
@@ -0,0 +1,96 @@
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Media;
+
+namespace WPFDevelopers.Controls
+{
+ public class ScaleBase : RangeBase//Control
+ {
+ //public static readonly DependencyProperty MaximumProperty =
+ // DependencyProperty.Register("Maximum", typeof(double), typeof(ScaleBase), new UIPropertyMetadata(0.0, OnMaximumChanged));
+
+ //private static void OnMaximumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ //{
+ // var ctrl = (ScaleBase)d;
+ // ctrl.OnMaximumChanged((double)e.OldValue, (double)e.NewValue);
+ //}
+ //protected virtual void OnMaximumChanged(double oldValue, double newValue)
+ //{
+ //}
+
+ //public static readonly DependencyProperty MinimumProperty =
+ // DependencyProperty.Register("Minimum", typeof(double), typeof(ScaleBase), new UIPropertyMetadata(0.0, OnMinimumChanged));
+
+ //private static void OnMinimumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ //{
+ // var ctrl = (ScaleBase)d;
+ // ctrl.OnMinimumChanged((double)e.OldValue, (double)e.NewValue);
+ //}
+ //protected virtual void OnMinimumChanged(double oldValue, double newValue)
+ //{
+ //}
+
+ //public static readonly DependencyProperty ValueProperty =
+ // DependencyProperty.Register("Value", typeof(double), typeof(ScaleBase), new UIPropertyMetadata(0.0, OnValueChanged));
+
+ //private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ //{
+ // var ctrl = (ScaleBase)d;
+ // ctrl.OnValueChanged((double)e.OldValue, (double)e.NewValue);
+ //}
+ //protected virtual void OnValueChanged(double oldValue, double newValue)
+ //{
+ //}
+
+ public static readonly DependencyProperty IntervalProperty =
+ DependencyProperty.Register("Interval", typeof(double), typeof(ScaleBase), new UIPropertyMetadata(0.0, OnIntervalChanged));
+ private static void OnIntervalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var ctrl = (ScaleBase)d;
+ ctrl.OnIntervalChanged((double)e.OldValue, (double)e.NewValue);
+ }
+ protected virtual void OnIntervalChanged(double oldValue, double newValue)
+ {
+ }
+
+ public static readonly DependencyProperty GeometryProperty =
+ DependencyProperty.Register("Geometry", typeof(Geometry), typeof(ScaleBase), new PropertyMetadata(null, OnGeometryChanged));
+ private static void OnGeometryChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var ctrl = (ScaleBase)d;
+ ctrl.OnGeometryChanged((Geometry)e.OldValue, (Geometry)e.NewValue);
+ }
+ protected virtual void OnGeometryChanged(Geometry oldValue, Geometry newValue)
+ {
+ }
+
+ //public double Maximum
+ //{
+ // get => (double)GetValue(MaximumProperty);
+ // set => SetValue(MaximumProperty, value);
+ //}
+
+ //public double Minimum
+ //{
+ // get => (double)GetValue(MinimumProperty);
+ // set => SetValue(MinimumProperty, value);
+ //}
+ //public double Value
+ //{
+ // get => (double)GetValue(ValueProperty);
+ // set => SetValue(ValueProperty, value);
+ //}
+ public double Interval
+ {
+ get => (double)GetValue(IntervalProperty);
+
+ set => SetValue(IntervalProperty, value);
+ }
+ public Geometry Geometry
+ {
+ get => (Geometry)GetValue(GeometryProperty);
+ set => SetValue(GeometryProperty, value);
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Shared/Controls/CircularMenu/CircularMenu.cs b/src/WPFDevelopers.Shared/Controls/CircleMenu/CircleMenu.cs
similarity index 96%
rename from src/WPFDevelopers.Shared/Controls/CircularMenu/CircularMenu.cs
rename to src/WPFDevelopers.Shared/Controls/CircleMenu/CircleMenu.cs
index d5bcc845..2f196723 100644
--- a/src/WPFDevelopers.Shared/Controls/CircularMenu/CircularMenu.cs
+++ b/src/WPFDevelopers.Shared/Controls/CircleMenu/CircleMenu.cs
@@ -11,7 +11,7 @@ namespace WPFDevelopers.Controls
[TemplatePart(Name = ItemsControlTemplateName, Type = typeof(ItemsControl))]
[TemplatePart(Name = EllipseGeometryTemplateName, Type = typeof(EllipseGeometry))]
[TemplatePart(Name = ToggleButtonTemplateName, Type = typeof(ToggleButton))]
- public class CircularMenu : ListBox
+ public class CircleMenu : ListBox
{
private const string ItemsControlTemplateName = "PART_ItemsControl";
private const string EllipseGeometryTemplateName = "PART_EllipseGeometry";
@@ -21,10 +21,10 @@ public class CircularMenu : ListBox
private ItemsControl _itemsControl;
private ToggleButton _toggleButton;
- static CircularMenu()
+ static CircleMenu()
{
- DefaultStyleKeyProperty.OverrideMetadata(typeof(CircularMenu),
- new FrameworkPropertyMetadata(typeof(CircularMenu)));
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(CircleMenu),
+ new FrameworkPropertyMetadata(typeof(CircleMenu)));
}
public override void OnApplyTemplate()
diff --git a/src/WPFDevelopers.Shared/Controls/CircularMenu/CircularMenuItem.cs b/src/WPFDevelopers.Shared/Controls/CircleMenu/CircleMenuItem.cs
similarity index 87%
rename from src/WPFDevelopers.Shared/Controls/CircularMenu/CircularMenuItem.cs
rename to src/WPFDevelopers.Shared/Controls/CircleMenu/CircleMenuItem.cs
index 0fea9cfd..5af9623b 100644
--- a/src/WPFDevelopers.Shared/Controls/CircularMenu/CircularMenuItem.cs
+++ b/src/WPFDevelopers.Shared/Controls/CircleMenu/CircleMenuItem.cs
@@ -5,30 +5,30 @@
namespace WPFDevelopers.Controls
{
- public class CircularMenuItem : Control
+ public class CircleMenuItem : Control
{
private const string RotateTransformTemplateName = "PART_RotateTransform";
- private static readonly Type _typeofSelf = typeof(CircularMenuItem);
+ private static readonly Type _typeofSelf = typeof(CircleMenuItem);
public static readonly DependencyProperty AngleProperty =
- DependencyProperty.Register("Angle", typeof(double), typeof(CircularMenuItem),
+ DependencyProperty.Register("Angle", typeof(double), typeof(CircleMenuItem),
new UIPropertyMetadata(OnAngleChanged));
public static readonly DependencyProperty MenuTxtProperty =
- DependencyProperty.Register("MenuTxt", typeof(string), typeof(CircularMenuItem),
+ DependencyProperty.Register("MenuTxt", typeof(string), typeof(CircleMenuItem),
new PropertyMetadata(string.Empty));
public static readonly DependencyProperty BackgroundColorProperty =
- DependencyProperty.Register("BackgroundColor", typeof(Brush), typeof(CircularMenuItem),
+ DependencyProperty.Register("BackgroundColor", typeof(Brush), typeof(CircleMenuItem),
new PropertyMetadata(null));
public static readonly DependencyProperty IconImageProperty =
- DependencyProperty.Register("IconImage", typeof(ImageSource), typeof(CircularMenuItem),
+ DependencyProperty.Register("IconImage", typeof(ImageSource), typeof(CircleMenuItem),
new PropertyMetadata(null));
private RotateTransform _angleRotateTransform;
- static CircularMenuItem()
+ static CircleMenuItem()
{
DefaultStyleKeyProperty.OverrideMetadata(_typeofSelf, new FrameworkPropertyMetadata(_typeofSelf));
}
@@ -45,7 +45,6 @@ public string MenuTxt
set => SetValue(MenuTxtProperty, value);
}
-
public Brush BackgroundColor
{
get => (Brush)GetValue(BackgroundColorProperty);
@@ -60,7 +59,7 @@ public ImageSource IconImage
private static void OnAngleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
- var control = (CircularMenuItem)d;
+ var control = (CircleMenuItem)d;
control.UpdateAngle();
}
diff --git a/src/WPFDevelopers.Shared/Controls/CircularProgressBar/CircularProgressBar.cs b/src/WPFDevelopers.Shared/Controls/CircleProgressBar/CircleProgressBar.cs
similarity index 70%
rename from src/WPFDevelopers.Shared/Controls/CircularProgressBar/CircularProgressBar.cs
rename to src/WPFDevelopers.Shared/Controls/CircleProgressBar/CircleProgressBar.cs
index c13c49cb..763a5e62 100644
--- a/src/WPFDevelopers.Shared/Controls/CircularProgressBar/CircularProgressBar.cs
+++ b/src/WPFDevelopers.Shared/Controls/CircleProgressBar/CircleProgressBar.cs
@@ -11,73 +11,63 @@ namespace WPFDevelopers.Controls
[TemplatePart(Name = PathFigureTemplateName, Type = typeof(PathFigure))]
[TemplatePart(Name = PathFigureAngleTemplateName, Type = typeof(PathFigure))]
[TemplatePart(Name = TextBlockTemplateName, Type = typeof(TextBlock))]
- public class CircularProgressBar : ProgressBar
+ public class CircleProgressBar : ProgressBar
{
private const string ArcSegmentTemplateName = "PART_ArcSegment";
private const string ArcSegmentAngleTemplateName = "PART_ArcSegmentAngle";
private const string PathFigureTemplateName = "PART_PathFigure";
private const string PathFigureAngleTemplateName = "PART_PathFigureAngle";
private const string TextBlockTemplateName = "PART_TextBlock";
+ private readonly Size _size = new Size(50,50);
private ArcSegment _arcSegment, _arcSegmentAngle;
private PathFigure _pathFigure, _pathFigureAngle;
private TextBlock _textBlock;
+ public static readonly DependencyProperty IsRoundProperty =
+ DependencyProperty.Register("IsRound", typeof(bool), typeof(CircleProgressBar),
+ new PropertyMetadata(true));
- public static readonly DependencyProperty SizeProperty =
- DependencyProperty.Register("Size", typeof(Size), typeof(CircularProgressBar),
- new PropertyMetadata(new Size(50,50)));
public static readonly DependencyProperty AngleProperty =
- DependencyProperty.Register("Angle", typeof(double), typeof(CircularProgressBar),
+ DependencyProperty.Register("Angle", typeof(double), typeof(CircleProgressBar),
new PropertyMetadata(0.0));
public static readonly DependencyProperty StrokeThicknessProperty =
- DependencyProperty.Register("StrokeThickness", typeof(double), typeof(CircularProgressBar),
- new PropertyMetadata(10.0));
+ DependencyProperty.Register("StrokeThickness", typeof(double), typeof(CircleProgressBar),
+ new PropertyMetadata(5.0));
public static readonly DependencyProperty BrushStrokeThicknessProperty =
- DependencyProperty.Register("BrushStrokeThickness", typeof(double), typeof(CircularProgressBar),
- new PropertyMetadata(1.0));
+ DependencyProperty.Register("BrushStrokeThickness", typeof(double), typeof(CircleProgressBar),
+ new PropertyMetadata(5.0));
- public CircularProgressBar()
+ public CircleProgressBar()
{
ValueChanged += CircularProgressBar_ValueChanged;
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
-
- if (Size.Width != Size.Height)
- {
- var max = Math.Max(Size.Width, Size.Height);
- Size = new Size(max, max);
- }
-
_pathFigure = GetTemplateChild(PathFigureTemplateName) as PathFigure;
_pathFigureAngle = GetTemplateChild(PathFigureAngleTemplateName) as PathFigure;
- _pathFigure.StartPoint = new Point(Size.Width, 0);
- _pathFigureAngle.StartPoint = new Point(Size.Width, 0);
+ _pathFigure.StartPoint = new Point(_size.Width, 0);
+ _pathFigureAngle.StartPoint = new Point(_size.Width, 0);
_arcSegment = GetTemplateChild(ArcSegmentTemplateName) as ArcSegment;
- _arcSegment.Size = Size;
- _arcSegment.Point = new Point(Size.Width - 0.000872664626, 7.61543361704753E-09);
+ _arcSegment.Size = _size;
+ _arcSegment.Point = new Point(_size.Width - 0.000872664626, 7.61543361704753E-09);
_arcSegmentAngle = GetTemplateChild(ArcSegmentAngleTemplateName) as ArcSegment;
- _arcSegmentAngle.Size = Size;
+ _arcSegmentAngle.Size = _size;
_textBlock = GetTemplateChild(TextBlockTemplateName) as TextBlock;
- if (Size.Width < 15)
- {
- FontSize = 8;
- }
}
-
- public Size Size
+
+ public bool IsRound
{
- get => (Size)GetValue(SizeProperty);
- set => SetValue(SizeProperty, value);
+ get => (bool)GetValue(IsRoundProperty);
+ set => SetValue(IsRoundProperty, value);
}
public double Angle
{
get => (double)GetValue(AngleProperty);
- set => SetValue(AngleProperty, value);
+ private set => SetValue(AngleProperty, value);
}
public double StrokeThickness
@@ -94,7 +84,7 @@ public double BrushStrokeThickness
private void CircularProgressBar_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
{
- var bar = sender as CircularProgressBar;
+ var bar = sender as CircleProgressBar;
var currentAngle = bar.Angle;
var targetAngle = e.NewValue / bar.Maximum * 359.999;
var anim = new DoubleAnimation(currentAngle, targetAngle, TimeSpan.FromMilliseconds(500));
diff --git a/src/WPFDevelopers.Shared/Controls/Drawer/Drawer.cs b/src/WPFDevelopers.Shared/Controls/Drawer/Drawer.cs
index 24784596..49f68218 100644
--- a/src/WPFDevelopers.Shared/Controls/Drawer/Drawer.cs
+++ b/src/WPFDevelopers.Shared/Controls/Drawer/Drawer.cs
@@ -14,7 +14,7 @@ public class Drawer : HeaderedContentControl
private const string BorderHeaderTemplateName = "PART_Header";
private const string BorderMarkTemplateName = "PART_Mark";
- public static readonly DependencyProperty EdgePositionProperty =
+ public static readonly DependencyProperty PositionProperty =
DependencyProperty.Register("Position", typeof(Position), typeof(Drawer),
new PropertyMetadata(Position.Left));
@@ -37,8 +37,8 @@ static Drawer()
public Position Position
{
- get => (Position) GetValue(EdgePositionProperty);
- set => SetValue(EdgePositionProperty, value);
+ get => (Position) GetValue(PositionProperty);
+ set => SetValue(PositionProperty, value);
}
public bool IsOpen
diff --git a/src/WPFDevelopers.Shared/Controls/Gauge/Gauge.cs b/src/WPFDevelopers.Shared/Controls/Gauge/Gauge.cs
new file mode 100644
index 00000000..4839eb9c
--- /dev/null
+++ b/src/WPFDevelopers.Shared/Controls/Gauge/Gauge.cs
@@ -0,0 +1,169 @@
+using System;
+using System.Windows;
+using System.Windows.Controls.Primitives;
+using System.Windows.Media;
+
+namespace WPFDevelopers.Controls
+{
+ public class Gauge : RangeBase
+ {
+ public string Title
+ {
+ get { return (string)GetValue(TitleProperty); }
+ set { SetValue(TitleProperty, value); }
+ }
+
+ public static readonly DependencyProperty TitleProperty =
+ DependencyProperty.Register("TitleProperty", typeof(string), typeof(Gauge), new PropertyMetadata("WD"));
+
+ public static readonly DependencyProperty ValueFormatProperty =
+ DependencyProperty.Register("ValueFormat", typeof(string), typeof(Gauge),
+ new PropertyMetadata("{0:0}%", OnValueFormatChanged));
+
+ private static void OnValueFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var gauge = d as Gauge;
+ gauge?.InvalidateVisual();
+ }
+
+ public string ValueFormat
+ {
+ get { return (string)GetValue(ValueFormatProperty); }
+ set { SetValue(ValueFormatProperty, value); }
+ }
+ public double Thickness
+ {
+ get { return (double)GetValue(ThicknessProperty); }
+ set { SetValue(ThicknessProperty, value); }
+ }
+
+ public static readonly DependencyProperty ThicknessProperty =
+ DependencyProperty.Register("Thickness", typeof(double), typeof(Gauge), new PropertyMetadata(10.0, OnValueFormatChanged));
+
+
+ static Gauge()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(Gauge), new FrameworkPropertyMetadata(typeof(Gauge)));
+ }
+
+ public Gauge()
+ {
+ SetValue(ValueProperty, 0.0);
+ SetValue(MinimumProperty, 0.0);
+ SetValue(MaximumProperty, 100.0);
+ }
+
+ protected override void OnValueChanged(double oldValue, double newValue)
+ {
+ InvalidateVisual();
+ }
+
+ protected override void OnMinimumChanged(double oldValue, double newValue)
+ {
+ InvalidateVisual();
+ }
+
+ protected override void OnMaximumChanged(double oldValue, double newValue)
+ {
+ InvalidateVisual();
+ }
+ protected override void OnRender(DrawingContext drawingContext)
+ {
+ base.OnRender(drawingContext);
+ if (Background == null)
+ Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#293950"));
+ var width = ActualWidth;
+ var height = ActualHeight;
+ var radius = Math.Min(width, height) / 2;
+ drawingContext.DrawEllipse(Background, new Pen(Background, Thickness), new Point(width / 2, height / 2), radius, radius);
+ var normalizedValue = (Value - Minimum) / (Maximum - Minimum);
+ var mappedAngle = -220 + normalizedValue * 260;
+ var angleInRadians = mappedAngle * Math.PI / 180;
+ var pointerLength = radius * 0.7;
+ var pointerX = width / 2 + pointerLength * Math.Cos(angleInRadians);
+ var pointerY = height / 2 + pointerLength * Math.Sin(angleInRadians);
+ drawingContext.DrawLine(new Pen(Brushes.Red, 2), new Point(width / 2, height / 2), new Point(pointerX, pointerY));
+ drawingContext.DrawEllipse(Brushes.White, new Pen(Brushes.Red, 2), new Point(width / 2, height / 2), width / 20, width / 20);
+ var pathGeometry = new PathGeometry();
+ var startAngle = -220;
+ angleInRadians = startAngle * Math.PI / 180;
+ var startX = width / 2 + radius * Math.Cos(angleInRadians);
+ var startY = height / 2 + radius * Math.Sin(angleInRadians);
+
+ var pathFigure = new PathFigure()
+ {
+ StartPoint = new Point(startX, startY),
+ };
+
+ var endAngle = 40;
+ angleInRadians = endAngle * Math.PI / 180;
+ var endX = width / 2 + radius * Math.Cos(angleInRadians);
+ var endY = height / 2 + radius * Math.Sin(angleInRadians);
+
+ var isLargeArc = (endAngle - startAngle > 180);
+ var arcSegment = new ArcSegment()
+ {
+ Point = new Point(endX, endY),
+ Size = new Size(radius, radius),
+ RotationAngle = 0,
+ SweepDirection = SweepDirection.Clockwise,
+ IsLargeArc = isLargeArc,
+ };
+
+ pathFigure.Segments.Add(arcSegment);
+ pathGeometry.Figures.Add(pathFigure);
+ if (BorderBrush == null)
+ {
+ var gradientBrush = new LinearGradientBrush
+ {
+ StartPoint = new Point(0, 0),
+ EndPoint = new Point(1, 0)
+ };
+ gradientBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#37D2C2"), 0.0));
+ gradientBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#5AD2B2"), 0.01));
+ gradientBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#B77D29"), 0.49));
+ gradientBrush.GradientStops.Add(new GradientStop(Colors.Red, 1.0));
+ gradientBrush.Freeze();
+ BorderBrush = gradientBrush;
+ }
+ drawingContext.DrawGeometry(null, new Pen(BorderBrush, Thickness), pathGeometry);
+ var tickLength = radius * 0.1;
+ var step = (Maximum - Minimum) / 10;
+ for (int i = 0; i <= 10; i++)
+ {
+ var angle = startAngle + (i * (endAngle - startAngle) / 10);
+ var tickStartX = width / 2 + (radius - tickLength) * Math.Cos(angle * Math.PI / 180);
+ var tickStartY = height / 2 + (radius - tickLength) * Math.Sin(angle * Math.PI / 180);
+ var tickEndX = width / 2 + (radius + Thickness / 2) * Math.Cos(angle * Math.PI / 180);
+ var tickEndY = height / 2 + (radius + Thickness / 2) * Math.Sin(angle * Math.PI / 180);
+ drawingContext.DrawLine(new Pen(Brushes.White, 2), new Point(tickStartX, tickStartY), new Point(tickEndX, tickEndY));
+
+ var labelValue = Minimum + step * i;
+ var formattedText = DrawingContextHelper.GetFormattedText(labelValue.ToString(),Brushes.White, FlowDirection.LeftToRight,FontSize);
+
+ var labelRadius = radius - tickLength * 2;
+ var labelX = width / 2 + labelRadius * Math.Cos(angle * Math.PI / 180) - formattedText.Width / 2;
+ var labelY = height / 2 + labelRadius * Math.Sin(angle * Math.PI / 180) - formattedText.Height / 2;
+ drawingContext.DrawText(formattedText, new Point(labelX, labelY));
+ }
+ var formattedValue = "{0:0}%";
+ try
+ {
+ formattedValue = string.Format(ValueFormat, Value);
+ }
+ catch (FormatException ex)
+ {
+ throw new InvalidOperationException("Formatting failed ", ex);
+ }
+ var currentValueText = DrawingContextHelper.GetFormattedText(formattedValue, Brushes.White, FlowDirection.LeftToRight, FontSize * 2);
+ var valueX = width / 2 - currentValueText.Width / 2;
+ var valueY = height / 2 + radius * 0.4;
+ drawingContext.DrawText(currentValueText, new Point(valueX, valueY));
+ var titleValue = DrawingContextHelper.GetFormattedText(Title, Brushes.White, FlowDirection.LeftToRight, FontSize);
+ valueX = width / 2 - titleValue.Width / 2;
+ valueY = height / 2 + radius * 0.8;
+ drawingContext.DrawText(titleValue, new Point(valueX, valueY));
+ }
+
+ }
+}
diff --git a/src/WPFDevelopers.Shared/Controls/Loadings/CycleLoading.cs b/src/WPFDevelopers.Shared/Controls/Loadings/CycleLoading.cs
index e1e7bac1..9337820d 100644
--- a/src/WPFDevelopers.Shared/Controls/Loadings/CycleLoading.cs
+++ b/src/WPFDevelopers.Shared/Controls/Loadings/CycleLoading.cs
@@ -16,9 +16,6 @@ public class CycleLoading : LoadingBase
DependencyProperty.Register("ValueDescription", typeof(string), typeof(CycleLoading),
new PropertyMetadata(default(string)));
- //public static readonly DependencyProperty IsStartProperty =
- // DependencyProperty.Register("IsStart", typeof(bool), typeof(CycleLoading), new PropertyMetadata(true));
-
public static readonly DependencyProperty LoadTitleProperty =
DependencyProperty.Register("LoadTitle", typeof(string), typeof(CycleLoading),
new PropertyMetadata(default(string)));
@@ -47,12 +44,6 @@ internal string ValueDescription
set => SetValue(ValueDescriptionProperty, value);
}
- //public bool IsStart
- //{
- // get => (bool)GetValue(IsStartProperty);
- // set => SetValue(IsStartProperty, value);
- //}
-
public string LoadTitle
{
get => (string)GetValue(LoadTitleProperty);
diff --git a/src/WPFDevelopers.Shared/Controls/Message/Message.cs b/src/WPFDevelopers.Shared/Controls/Message/Message.cs
index 7852c295..a707e1a2 100644
--- a/src/WPFDevelopers.Shared/Controls/Message/Message.cs
+++ b/src/WPFDevelopers.Shared/Controls/Message/Message.cs
@@ -1,30 +1,40 @@
using System;
using System.Windows;
using WPFDevelopers.Helpers;
+using System.Windows.Media;
namespace WPFDevelopers.Controls
{
public static class Message
{
- private static MessageAdorner messageAdorner;
+ private static MessageAdorner _messageAdorner;
+ private static MessageExt _messageExt;
+ private static Position _position;
static void CreateMessageAdorner(Window owner = null, string message = null, MessageBoxImage type = MessageBoxImage.Information, bool center = false)
{
try
{
- if (messageAdorner != null)
+ if (_messageAdorner != null)
{
- messageAdorner.Push(message, type, center);
- return;
+ if (_messageAdorner.Position != _position)
+ _messageAdorner.Position = _position;
+ _messageAdorner.Push(message, type, center);
+ }
+ else
+ {
+ if (owner == null)
+ owner = ControlsHelper.GetDefaultWindow();
+ var layer = ControlsHelper.GetAdornerLayer(owner);
+ if (layer == null)
+ throw new Exception("AdornerLayer is not empty, it is recommended to use PushDesktop");
+ _messageAdorner = new MessageAdorner(layer);
+ layer.Add(_messageAdorner);
+ if (_messageAdorner.Position != _position)
+ _messageAdorner.Position = _position;
+ if (!string.IsNullOrWhiteSpace(message))
+ _messageAdorner.Push(message, type, center);
}
- if (owner == null)
- owner = ControlsHelper.GetDefaultWindow();
- var layer = ControlsHelper.GetAdornerLayer(owner);
- if (layer == null)
- throw new Exception("not AdornerLayer is null");
- messageAdorner = new MessageAdorner(layer);
- layer.Add(messageAdorner);
- messageAdorner.Push(message, type, center);
}
catch (Exception)
{
@@ -39,5 +49,37 @@ public static void Push(string message, MessageBoxImage type = MessageBoxImage.I
{
CreateMessageAdorner(message: message, type: type, center: center);
}
+
+ public static void PushDesktop(string message, MessageBoxImage type = MessageBoxImage.Information, bool center = false)
+ {
+ if (_messageExt == null)
+ {
+ _messageExt = new MessageExt();
+ _messageExt.Closed += delegate { _messageExt = null; };
+ }
+ if (!_messageExt.IsVisible)
+ _messageExt.Show();
+ if (_messageExt.Position != _position)
+ {
+ _messageExt.IsPosition = false;
+ _messageExt.Position = _position;
+ }
+ _messageExt.Push(message, type, center);
+ }
+ public static void SetPosition(Position position = Position.Top)
+ {
+ if (_position != position)
+ _position = position;
+ }
+ public static void Clear()
+ {
+ if(_messageAdorner != null)
+ _messageAdorner.Clear();
+ }
+ public static void ClearDesktop()
+ {
+ if (_messageExt != null)
+ _messageExt.Clear();
+ }
}
}
diff --git a/src/WPFDevelopers.Shared/Controls/Message/MessageAdorner.cs b/src/WPFDevelopers.Shared/Controls/Message/MessageAdorner.cs
index e9167ff8..fae377a6 100644
--- a/src/WPFDevelopers.Shared/Controls/Message/MessageAdorner.cs
+++ b/src/WPFDevelopers.Shared/Controls/Message/MessageAdorner.cs
@@ -6,23 +6,28 @@ namespace WPFDevelopers.Controls
{
public class MessageAdorner : Adorner
{
- private MessageListBox listBox;
+ private MessageListBox _listBox;
private UIElement _child;
- private FrameworkElement adornedElement;
+ private FrameworkElement _adornedElement;
+ internal Position Position;
public MessageAdorner(UIElement adornedElement) : base(adornedElement)
{
- this.adornedElement = adornedElement as FrameworkElement;
+ _adornedElement = adornedElement as FrameworkElement;
}
-
- public void Push(string message, MessageBoxImage type = MessageBoxImage.Information, bool center = false)
+ internal void Push(string message, MessageBoxImage type = MessageBoxImage.Information, bool center = false)
{
- if (listBox == null)
+ if (_listBox == null)
{
- listBox = new MessageListBox();
- Child = listBox;
+ _listBox = new MessageListBox();
+ Child = _listBox;
}
var mItem = new MessageListBoxItem { Content = message, MessageType = type, IsCenter = center };
- listBox.Items.Insert(0, mItem);
+ _listBox.Items.Insert(0, mItem);
+ }
+ internal void Clear()
+ {
+ if(_listBox != null)
+ _listBox.Items.Clear();
}
public UIElement Child
{
@@ -49,8 +54,24 @@ protected override int VisualChildrenCount
protected override Size ArrangeOverride(Size finalSize)
{
- var x = (adornedElement.ActualWidth - _child.DesiredSize.Width) / 2;
- _child.Arrange(new Rect(new Point(x, 0), _child.DesiredSize));
+ if (_child == null)
+ return finalSize;
+ double x = 0;
+ double y = 0;
+ switch (Position)
+ {
+ case Position.Top:
+ x = (_adornedElement.ActualWidth - _child.DesiredSize.Width) / 2;
+ break;
+ case Position.Right:
+ x = _adornedElement.ActualWidth - _child.DesiredSize.Width;
+ break;
+ case Position.Bottom:
+ x = (_adornedElement.ActualWidth - _child.DesiredSize.Width) / 2;
+ y = _adornedElement.ActualHeight - _child.DesiredSize.Height;
+ break;
+ }
+ _child.Arrange(new Rect(new Point(x, y), _child.DesiredSize));
return finalSize;
}
diff --git a/src/WPFDevelopers.Shared/Controls/Message/MessageExt.cs b/src/WPFDevelopers.Shared/Controls/Message/MessageExt.cs
new file mode 100644
index 00000000..91ed284b
--- /dev/null
+++ b/src/WPFDevelopers.Shared/Controls/Message/MessageExt.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Windows;
+using System.Windows.Media;
+
+namespace WPFDevelopers.Controls
+{
+ public sealed class MessageExt : Window
+ {
+ private MessageListBox _listBox;
+ internal bool IsPosition;
+ internal Position Position;
+
+ public MessageExt()
+ {
+ SizeToContent = SizeToContent.Width;
+ ResizeMode = ResizeMode.NoResize;
+ ShowInTaskbar = false;
+ ShowActivated = false;
+ Background = Brushes.Transparent;
+ WindowStyle = WindowStyle.None;
+ AllowsTransparency = true;
+ Topmost = true;
+ if (_listBox == null)
+ {
+ _listBox = new MessageListBox();
+ _listBox.SizeChanged -= ListBox_SizeChanged;
+ _listBox.SizeChanged += ListBox_SizeChanged;
+ Content = _listBox;
+ }
+
+ }
+
+ internal void Push(string message, MessageBoxImage type = MessageBoxImage.Information, bool center = false)
+ {
+ var desktopWorkingArea = SystemParameters.WorkArea;
+ var item = new MessageListBoxItem { Content = message, MessageType = type, IsCenter = center };
+ _listBox.Items.Insert(0, item);
+ if (!IsPosition || Position == Position.Bottom)
+ {
+ double x = 0;
+ double y = 0;
+ switch (Position)
+ {
+ case Position.Top:
+ x = (desktopWorkingArea.Right - item.Width) / 2;
+ break;
+ case Position.Right:
+ x = desktopWorkingArea.Right - (item.Width + item.Margin.Right + item.Padding.Right);
+ break;
+ case Position.Bottom:
+ x = (desktopWorkingArea.Right - item.Width) / 2;
+ _listBox.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
+ var controlHeight = _listBox.DesiredSize.Height;
+ y = desktopWorkingArea.Height - controlHeight;
+ break;
+ }
+ Height = desktopWorkingArea.Height;
+ Left = x;
+ Top = y;
+ IsPosition = true;
+ }
+ }
+ internal void Clear()
+ {
+ if(_listBox!=null)
+ _listBox.Items.Clear();
+ Close();
+ }
+ private void ListBox_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ if(_listBox.ActualHeight <= 10)
+ Close();
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Shared/Controls/MessageBox/WDMessageBox.cs b/src/WPFDevelopers.Shared/Controls/MessageBox/WDMessageBox.cs
index fe03db52..9409a759 100644
--- a/src/WPFDevelopers.Shared/Controls/MessageBox/WDMessageBox.cs
+++ b/src/WPFDevelopers.Shared/Controls/MessageBox/WDMessageBox.cs
@@ -256,7 +256,7 @@ private void DisplayImage(MessageBoxImage image)
case MessageBoxImage.Information:
_geometry = (Geometry) Application.Current.TryFindResource("WD.WarningGeometry");
_solidColorBrush =
- (SolidColorBrush) Application.Current.TryFindResource("WD.SuccessSolidColorBrush");
+ (SolidColorBrush) Application.Current.TryFindResource("WD.SuccessNormalBrush");
break;
case MessageBoxImage.Question:
_geometry = (Geometry) Application.Current.TryFindResource("WD.QuestionGeometry");
diff --git a/src/WPFDevelopers.Shared/Controls/MultiSelectionSearchComboBox/MultiSelectSearchComboBox.cs b/src/WPFDevelopers.Shared/Controls/MultiSelectionSearchComboBox/MultiSelectSearchComboBox.cs
index 6fd5046e..f0cd05f6 100644
--- a/src/WPFDevelopers.Shared/Controls/MultiSelectionSearchComboBox/MultiSelectSearchComboBox.cs
+++ b/src/WPFDevelopers.Shared/Controls/MultiSelectionSearchComboBox/MultiSelectSearchComboBox.cs
@@ -79,7 +79,7 @@ public class MultiSelectionSearchComboBox : Control
public static readonly DependencyProperty SelectedItemsProperty =
DependencyProperty.Register("SelectedItems", typeof(IList), typeof(MultiSelectionSearchComboBox),
- new FrameworkPropertyMetadata(null,
+ new FrameworkPropertyMetadata(new ArrayList(),
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
OnSelectedItemsChanged));
@@ -109,37 +109,37 @@ static MultiSelectionSearchComboBox()
public string Delimiter
{
- get => (string) GetValue(DelimiterProperty);
+ get => (string)GetValue(DelimiterProperty);
set => SetValue(DelimiterProperty, value);
}
public string SelectedValuePath
{
- get => (string) GetValue(SelectedValuePathProperty);
+ get => (string)GetValue(SelectedValuePathProperty);
set => SetValue(SelectedValuePathProperty, value);
}
public string DisplayMemberPath
{
- get => (string) GetValue(DisplayMemberPathProperty);
+ get => (string)GetValue(DisplayMemberPathProperty);
set => SetValue(DisplayMemberPathProperty, value);
}
public string Text
{
- get => (string) GetValue(TextProperty);
+ get => (string)GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
public IEnumerable ItemsSource
{
- get => (IEnumerable) GetValue(ItemsSourceProperty);
+ get => (IEnumerable)GetValue(ItemsSourceProperty);
set => SetValue(ItemsSourceProperty, value);
}
public IEnumerable ItemsSourceSearch
{
- get => (IEnumerable) GetValue(ItemsSourceSearchProperty);
+ get => (IEnumerable)GetValue(ItemsSourceSearchProperty);
set => SetValue(ItemsSourceSearchProperty, value);
}
@@ -151,31 +151,31 @@ public object SelectAllContent
public bool IsSelectAllActive
{
- get => (bool) GetValue(IsSelectAllActiveProperty);
+ get => (bool)GetValue(IsSelectAllActiveProperty);
set => SetValue(IsSelectAllActiveProperty, value);
}
public bool IsDropDownOpen
{
- get => (bool) GetValue(IsDropDownOpenProperty);
+ get => (bool)GetValue(IsDropDownOpenProperty);
set => SetValue(IsDropDownOpenProperty, value);
}
public double MaxDropDownHeight
{
- get => (double) GetValue(MaxDropDownHeightProperty);
+ get => (double)GetValue(MaxDropDownHeightProperty);
set => SetValue(MaxDropDownHeightProperty, value);
}
public IList SelectedItems
{
- get => (IList) GetValue(SelectedItemsProperty);
+ get => (IList)GetValue(SelectedItemsProperty);
set => SetValue(SelectedItemsProperty, value);
}
public string SearchWatermark
{
- get => (string) GetValue(SearchWatermarkProperty);
+ get => (string)GetValue(SearchWatermarkProperty);
set => SetValue(SearchWatermarkProperty, value);
}
@@ -236,18 +236,18 @@ public override void OnApplyTemplate()
private void Instance_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
- SelectAllContent = LanguageManager.Instance["SelectAll"];
+ SelectAllContent = LanguageManager.Instance["SelectAll"];
}
private void OnListBoxSearch_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
- if ((bool) e.NewValue)
+ if ((bool)e.NewValue)
UpdateIsChecked(_listBoxSearch);
}
private void OnListBox_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
- if ((bool) e.NewValue)
+ if ((bool)e.NewValue)
{
foreach (var item in selectedSearchList)
if (!_listBox.SelectedItems.Contains(item))
@@ -277,7 +277,7 @@ private void UpdateIsChecked(ListBox listBox)
private void OnPopup_GotFocus(object sender, RoutedEventArgs e)
{
- var source = (HwndSource) PresentationSource.FromVisual(_popup.Child);
+ var source = (HwndSource)PresentationSource.FromVisual(_popup.Child);
if (source != null)
{
SetFocus(source.Handle);
@@ -356,7 +356,17 @@ private void OnListBox_SelectionChanged(object sender, SelectionChangedEventArgs
if (e.AddedItems.Count > 0)
SelectionChecked(_listBox);
Combination();
- SelectedItems = _listBox.SelectedItems;
+ var selectedItems = _listBox.SelectedItems;
+ if (SelectedItems == null)
+ SelectedItems = selectedItems;
+ else
+ {
+ foreach (var item in selectedItems)
+ {
+ if (!SelectedItems.Contains(item))
+ SelectedItems.Add(item);
+ }
+ }
}
private void OnListBoxSearch_SelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -497,7 +507,7 @@ private static void OnIsDropDownOpenChanged(DependencyObject o, DependencyProper
{
var multiSelectionSearchComboBox = o as MultiSelectionSearchComboBox;
if (multiSelectionSearchComboBox != null)
- multiSelectionSearchComboBox.OnIsOpenChanged((bool) e.OldValue, (bool) e.NewValue);
+ multiSelectionSearchComboBox.OnIsOpenChanged((bool)e.OldValue, (bool)e.NewValue);
}
protected virtual void OnIsOpenChanged(bool oldValue, bool newValue)
@@ -516,7 +526,7 @@ private static void OnMaxDropDownHeightChanged(DependencyObject o, DependencyPro
{
var comboBox = o as MultiSelectionSearchComboBox;
if (comboBox != null)
- comboBox.OnMaxDropDownHeightChanged((double) e.OldValue, (double) e.NewValue);
+ comboBox.OnMaxDropDownHeightChanged((double)e.OldValue, (double)e.NewValue);
}
protected virtual void OnMaxDropDownHeightChanged(double oldValue, double newValue)
diff --git a/src/WPFDevelopers.Shared/Controls/PathIcon/PackIconKind.cs b/src/WPFDevelopers.Shared/Controls/PathIcon/PackIconKind.cs
index d59266fd..f41b2163 100644
--- a/src/WPFDevelopers.Shared/Controls/PathIcon/PackIconKind.cs
+++ b/src/WPFDevelopers.Shared/Controls/PathIcon/PackIconKind.cs
@@ -54,5 +54,7 @@ public enum PackIconKind
[Description("WD.BreadCrumbBarGeometry")] BreadCrumbBar,
[Description("WD.UnfoldMoreGeometry")] UnfoldMore,
[Description("WD.TimeGeometry")] Time,
+ [Description("WD.DateRangeRightGeometry")] DateRangeRight,
+ [Description("WD.DateGeometry")] Date,
}
}
diff --git a/src/WPFDevelopers.Shared/Controls/Ruler/Ruler.cs b/src/WPFDevelopers.Shared/Controls/Ruler/Ruler.cs
index 02ba47c6..f35f6187 100644
--- a/src/WPFDevelopers.Shared/Controls/Ruler/Ruler.cs
+++ b/src/WPFDevelopers.Shared/Controls/Ruler/Ruler.cs
@@ -1,36 +1,27 @@
-using System;
-using System.Windows;
-using System.Windows.Controls;
+using System.Windows;
using System.Windows.Media;
namespace WPFDevelopers.Controls
{
- public class Ruler : Control
+ public class Ruler : ScaleBase
{
- public static readonly DependencyProperty IntervalProperty =
- DependencyProperty.Register("Interval", typeof(double), typeof(Ruler), new UIPropertyMetadata(30.0));
-
-
public static readonly DependencyProperty SpanIntervalProperty =
- DependencyProperty.Register("SpanInterval", typeof(double), typeof(Ruler), new UIPropertyMetadata(5.0));
+ DependencyProperty.Register("SpanInterval", typeof(double), typeof(Ruler), new UIPropertyMetadata(5.0, OnSpanIntervalChanged));
+ private static void OnSpanIntervalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var ctrl = d as Ruler;
+ ctrl?.InvalidateVisual();
+ }
public static readonly DependencyProperty MiddleMaskProperty =
- DependencyProperty.Register("MiddleMask", typeof(int), typeof(Ruler), new UIPropertyMetadata(2));
-
- public static readonly DependencyProperty CurrentValueProperty =
- DependencyProperty.Register("CurrentValue", typeof(double), typeof(Ruler),
- new UIPropertyMetadata(OnCurrentValueChanged));
+ DependencyProperty.Register("MiddleMask", typeof(int), typeof(Ruler), new UIPropertyMetadata(2, OnMiddleMaskChanged));
- public static readonly DependencyProperty StartValueProperty =
- DependencyProperty.Register("StartValue", typeof(double), typeof(Ruler), new UIPropertyMetadata(120.0));
-
- public static readonly DependencyProperty EndValueProperty =
- DependencyProperty.Register("EndValue", typeof(double), typeof(Ruler), new UIPropertyMetadata(240.0));
-
- public static readonly DependencyProperty CurrentGeometryProperty =
- DependencyProperty.Register("CurrentGeometry", typeof(Geometry), typeof(Ruler),
- new PropertyMetadata(Geometry.Parse("M 257,0 257,25 264,49 250,49 257,25")));
+ private static void OnMiddleMaskChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var ctrl = d as Ruler;
+ ctrl?.InvalidateVisual();
+ }
static Ruler()
{
@@ -39,77 +30,55 @@ static Ruler()
public Ruler()
{
+ SetValue(MaximumProperty, 240.0);
+ SetValue(MinimumProperty, 120.0);
+ SetValue(IntervalProperty, 30.0);
+ SetValue(GeometryProperty, Geometry.Parse(@"M 257,0 257,25 264,49 250,49 257,25"));
Loaded += Ruler_Loaded;
}
- public double Interval
+ protected override void OnValueChanged(double oldValue, double newValue)
{
- get => (double)GetValue(IntervalProperty);
-
- set => SetValue(IntervalProperty, value);
- }
-
- public double SpanInterval
- {
- get => (double)GetValue(SpanIntervalProperty);
-
- set => SetValue(SpanIntervalProperty, value);
+ PaintPath();
}
-
- public int MiddleMask
+ protected override void OnMaximumChanged(double oldValue, double newValue)
{
- get => (int)GetValue(MiddleMaskProperty);
-
- set => SetValue(MiddleMaskProperty, value);
+ InvalidateVisual();
}
- public double CurrentValue
+ protected override void OnMinimumChanged(double oldValue, double newValue)
{
- get => (double)GetValue(CurrentValueProperty);
-
- set
- {
- SetValue(CurrentValueProperty, value);
- PaintPath();
- }
+ InvalidateVisual();
}
- public double StartValue
+ protected override void OnIntervalChanged(double oldValue, double newValue)
{
- get => (double)GetValue(StartValueProperty);
-
- set => SetValue(StartValueProperty, value);
+ InvalidateVisual();
}
- public double EndValue
+ public double SpanInterval
{
- get => (double)GetValue(EndValueProperty);
+ get => (double)GetValue(SpanIntervalProperty);
- set => SetValue(EndValueProperty, value);
+ set => SetValue(SpanIntervalProperty, value);
}
- public Geometry CurrentGeometry
+ public int MiddleMask
{
- get => (Geometry)GetValue(CurrentGeometryProperty);
-
- set => SetValue(CurrentGeometryProperty, value);
- }
+ get => (int)GetValue(MiddleMaskProperty);
- private static void OnCurrentValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var ruler = d as Ruler;
- ruler.CurrentValue = Convert.ToDouble(e.NewValue);
+ set => SetValue(MiddleMaskProperty, value);
}
protected override void OnRender(DrawingContext drawingContext)
{
RenderOptions.SetEdgeMode(this, EdgeMode.Aliased);
var nextLineValue = 0d;
- var one_Width = ActualWidth / ((EndValue - StartValue) / Interval);
+ var one_Width = ActualWidth / ((Maximum - Minimum) / Interval);
- for (var i = 0; i <= (EndValue - StartValue) / Interval; i++)
+ for (var i = 0; i <= (Maximum - Minimum) / Interval; i++)
{
- var numberText = DrawingContextHelper.GetFormattedText((StartValue + i * Interval).ToString(),
+ var numberText = DrawingContextHelper.GetFormattedText((Minimum + i * Interval).ToString(),
(Brush)DrawingContextHelper.BrushConverter.ConvertFromString("#FFFFFF"), FlowDirection.LeftToRight,
10);
drawingContext.DrawText(numberText, new Point(i * one_Width - 8, 0));
@@ -130,17 +99,19 @@ protected override void OnRender(DrawingContext drawingContext)
}
}
- private void Ruler_Loaded(object sender, RoutedEventArgs e)
+ void Ruler_Loaded(object sender, RoutedEventArgs e)
{
PaintPath();
}
- private void PaintPath()
+ void PaintPath()
{
- var d_Value = CurrentValue - StartValue;
- var one_Value = ActualWidth / (EndValue - StartValue);
+ if (Parent == null)
+ return;
+ var d_Value = Value - Minimum;
+ var one_Value = ActualWidth / (Maximum - Minimum);
var x_Point = one_Value * d_Value + ((double)Parent.GetValue(ActualWidthProperty) - ActualWidth) / 2d;
- CurrentGeometry =
+ Geometry =
Geometry.Parse($"M {x_Point},0 {x_Point},25 {x_Point + 7},49 {x_Point - 7},49 {x_Point},25");
}
}
diff --git a/src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCapture.cs b/src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCapture.cs
index b59a6433..2f2fa30d 100644
--- a/src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCapture.cs
+++ b/src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCapture.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Media.Imaging;
@@ -24,6 +25,10 @@ public class ScreenCapture
///
public event ScreenShotCanceled SnapCanceled;
///
+ /// 获取保存的图片全路径
+ ///
+ public event Action SnapSaveFullPath;
+ ///
/// 是否将截图结果复制
/// 默认复制
///
@@ -49,10 +54,16 @@ private ScreenCut CaptureScreen(int index)
ScreenCut screenCut = new ScreenCut(index);
screenCut.CutCompleted += ScreenCut_CutCompleted;
screenCut.CutCanceled += ScreenCut_CutCanceled;
+ screenCut.CutFullPath += ScreenCut_CutFullPath;
screenCut.Closed += ScreenCut_Closed;
return screenCut;
}
+ private void ScreenCut_CutFullPath(string text)
+ {
+ if(SnapSaveFullPath != null) SnapSaveFullPath(text);
+ }
+
private void ScreenCut_CutCanceled()
{
if (SnapCanceled != null) SnapCanceled();
diff --git a/src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCaptureExt.cs b/src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCaptureExt.cs
index 4e14739a..b8fe61b0 100644
--- a/src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCaptureExt.cs
+++ b/src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCaptureExt.cs
@@ -1,15 +1,17 @@
using System;
using System.Diagnostics;
using System.IO;
+using System.Linq;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
+using WPFDevelopers.Helpers;
namespace WPFDevelopers.Controls
{
public class ScreenCaptureExt : Window
{
-
+ private ThemeType? _theme;
///
/// 截图完成委托
///
@@ -26,9 +28,23 @@ public class ScreenCaptureExt : Window
/// 截图取消事件
///
public event ScreenShotCanceled SnapCanceled;
+ ///
+ /// 获取保存的图片全路径
+ ///
+ public event Action SnapSaveFullPath;
- public ScreenCaptureExt()
+ public ScreenCaptureExt(ThemeType? themeType = null)
{
+ if(themeType == null)
+ {
+ var existingResourceDictionary =
+ (Resources)Application.Current.Resources.MergedDictionaries.FirstOrDefault(x => x is Resources);
+ if (existingResourceDictionary != null)
+ themeType = existingResourceDictionary.Theme;
+ else
+ themeType = ThemeType.Dark;
+ }
+ _theme = themeType;
Width = 0;
Height = 0;
Left = int.MinValue;
@@ -61,6 +77,10 @@ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref b
if (SnapCanceled != null)
SnapCanceled();
break;
+ case Helper.MY_MESSAGEFULLPATH:
+ Close();
+ GetClipboard();
+ break;
}
return IntPtr.Zero;
}
@@ -88,15 +108,22 @@ void GetClipboard()
SnapCompleted(bitmapImage);
}
}
+ else if (Clipboard.ContainsText())
+ {
+ var clipboardText = Clipboard.GetText();
+ if (SnapSaveFullPath != null)
+ SnapSaveFullPath(clipboardText);
+ }
}
void ShowScreenShot()
{
+ string[] args = { Title, _theme.ToString() };//1.窗体tilte 2.Light或Dark
if (Helper.GetTempPathVersionExt != null && File.Exists(Helper.GetTempPathVersionExt))
{
var process = new Process();
process.StartInfo.FileName = Helper.GetTempPathVersionExt;
- process.StartInfo.Arguments = Title;
+ process.StartInfo.Arguments = string.Join(" ", args);
process.Start();
}
}
diff --git a/src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCut.cs b/src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCut.cs
index 83fd932e..66423bee 100644
--- a/src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCut.cs
+++ b/src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCut.cs
@@ -183,6 +183,10 @@ public class ScreenCut : Window, IDisposable
/// 截图取消事件
///
public event ScreenShotCanceled CutCanceled;
+ ///
+ /// 获取保存的图片全路径
+ ///
+ public event Action CutFullPath;
private double _y1;
private int _screenIndex;
public static int CaptureScreenID = -1;
@@ -428,6 +432,8 @@ private void ButtonSave_Click(object sender, RoutedEventArgs e)
fs.Dispose();
fs.Close();
Close();
+ if (CutFullPath != null)
+ CutFullPath(dlg.FileName);
}
}
}
diff --git a/src/WPFDevelopers.Shared/Controls/Thermometer/Thermometer.cs b/src/WPFDevelopers.Shared/Controls/Thermometer/Thermometer.cs
index cc474d1e..6b0c9cc1 100644
--- a/src/WPFDevelopers.Shared/Controls/Thermometer/Thermometer.cs
+++ b/src/WPFDevelopers.Shared/Controls/Thermometer/Thermometer.cs
@@ -1,104 +1,62 @@
-using System;
-using System.Windows;
-using System.Windows.Controls;
+using System.Windows;
using System.Windows.Media;
namespace WPFDevelopers.Controls
{
- public class Thermometer : Control
+ public class Thermometer : ScaleBase
{
- public static readonly DependencyProperty MaxValueProperty =
- DependencyProperty.Register("MaxValue", typeof(double), typeof(Thermometer), new UIPropertyMetadata(40.0));
-
- public static readonly DependencyProperty MinValueProperty =
- DependencyProperty.Register("MinValue", typeof(double), typeof(Thermometer), new UIPropertyMetadata(-10.0));
-
- ///
- /// 当前值
- ///
- public static readonly DependencyProperty CurrentValueProperty =
- DependencyProperty.Register("CurrentValue", typeof(double), typeof(Thermometer),
- new UIPropertyMetadata(OnCurrentValueChanged));
-
- ///
- /// 步长
- ///
- public static readonly DependencyProperty IntervalProperty =
- DependencyProperty.Register("Interval", typeof(double), typeof(Thermometer), new UIPropertyMetadata(10.0));
-
- ///
- /// 当前值的图形坐标点
- ///
- public static readonly DependencyProperty CurrentGeometryProperty =
- DependencyProperty.Register("CurrentGeometry", typeof(Geometry), typeof(Thermometer), new PropertyMetadata(
- Geometry.Parse(@"M 2 132.8
- a 4 4 0 0 1 4 -4
- h 18
- a 4 4 0 0 1 4 4
- v 32.2
- a 4 4 0 0 1 -4 4
- h -18
- a 4 4 0 0 1 -4 -4 z")));
-
- ///
- /// 构造函数
- ///
+ public new double Maximum
+ {
+ get { return base.Maximum; }
+
+ }
+ public new double Minimum
+ {
+ get { return base.Minimum; }
+
+ }
static Thermometer()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(Thermometer),
new FrameworkPropertyMetadata(typeof(Thermometer)));
}
-
- public double MaxValue
+ public Thermometer()
{
- get => (double)GetValue(MaxValueProperty);
-
- set => SetValue(MaxValueProperty, value);
- }
-
- public double MinValue
- {
- get => (double)GetValue(MinValueProperty);
-
- set => SetValue(MinValueProperty, value);
+ SetValue(MaximumProperty, 40.0);
+ SetValue(MinimumProperty, -10.0);
+ SetValue(IntervalProperty, 10.0);
+ SetValue(GeometryProperty, Geometry.Parse(@"M 2 132.8
+ a 4 4 0 0 1 4 -4
+ h 18
+ a 4 4 0 0 1 4 4
+ v 32.2
+ a 4 4 0 0 1 -4 4
+ h -18
+ a 4 4 0 0 1 -4 -4 z"));
}
-
- public double CurrentValue
+ protected override void OnValueChanged(double oldValue, double newValue)
{
- get => (double)GetValue(CurrentValueProperty);
-
- set
- {
- SetValue(CurrentValueProperty, value);
-
- PaintPath();
- }
+ PaintPath();
}
- public double Interval
+ protected override void OnMaximumChanged(double oldValue, double newValue)
{
- get => (double)GetValue(IntervalProperty);
-
- set => SetValue(IntervalProperty, value);
+ InvalidateVisual();
}
- public Geometry CurrentGeometry
+ protected override void OnMinimumChanged(double oldValue, double newValue)
{
- get => (Geometry)GetValue(CurrentGeometryProperty);
-
- set => SetValue(CurrentGeometryProperty, value);
+ InvalidateVisual();
}
- private static void OnCurrentValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ protected override void OnIntervalChanged(double oldValue, double newValue)
{
- var thermometer = d as Thermometer;
- thermometer.CurrentValue = Convert.ToDouble(e.NewValue);
+ InvalidateVisual();
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
-
PaintPath();
}
@@ -168,7 +126,7 @@ protected override void OnRender(DrawingContext drawingContext)
#region 画刻度
- var total_Value = MaxValue - MinValue;
+ var total_Value = Maximum - Minimum;
var cnt = total_Value / Interval;
@@ -176,14 +134,14 @@ protected override void OnRender(DrawingContext drawingContext)
for (var i = 0; i <= cnt; i++)
{
- var formattedText = DrawingContextHelper.GetFormattedText($"{MaxValue - i * Interval}",
+ var formattedText = DrawingContextHelper.GetFormattedText($"{Maximum - i * Interval}",
(Brush)DrawingContextHelper.BrushConverter.ConvertFromString("#82848A"), FlowDirection.LeftToRight,
14D);
drawingContext.DrawText(formattedText,
new Point(43, i * one_value - formattedText.Height / 2d)); //减去字体高度的一半
- formattedText = DrawingContextHelper.GetFormattedText($"{(MaxValue - i * Interval) * 1.8d + 32d}",
+ formattedText = DrawingContextHelper.GetFormattedText($"{(Maximum - i * Interval) * 1.8d + 32d}",
(Brush)DrawingContextHelper.BrushConverter.ConvertFromString("#82848A"), textSize: 14D);
drawingContext.DrawText(formattedText, new Point(-13, i * one_value - formattedText.Height / 2d));
@@ -206,25 +164,18 @@ protected override void OnRender(DrawingContext drawingContext)
///
private void PaintPath()
{
- var one_value = 161d / ((MaxValue - MinValue) / Interval);
-
+ var one_value = 161d / ((Maximum - Minimum) / Interval);
var width = 26d;
-
- var height = 169d - (MaxValue - CurrentValue) * (one_value / Interval);
-
- var x = 2d;
-
- var y = 169d - (169d - (MaxValue - CurrentValue) * (one_value / Interval));
-
-
- CurrentGeometry = Geometry.Parse($@"M 2 {y + 4}
- a 4 4 0 0 1 4 -4
- h {width - 8}
- a 4 4 0 0 1 4 4
- v {height - 8}
- a 4 4 0 0 1 -4 4
- h -{width - 8}
- a 4 4 0 0 1 -4 -4 z");
+ var height = 169d - (Maximum - Value) * (one_value / Interval);
+ var y = 169d - (169d - (Maximum - Value) * (one_value / Interval));
+ Geometry = Geometry.Parse($@"M 2 {y + 4}
+ a 4 4 0 0 1 4 -4
+ h {width - 8}
+ a 4 4 0 0 1 4 4
+ v {height - 8}
+ a 4 4 0 0 1 -4 4
+ h -{width - 8}
+ a 4 4 0 0 1 -4 -4 z");
}
}
}
\ No newline at end of file
diff --git a/src/WPFDevelopers.Shared/Controls/TimePicker/TimePicker.cs b/src/WPFDevelopers.Shared/Controls/TimePicker/TimePicker.cs
index d3f4413c..b927dbd6 100644
--- a/src/WPFDevelopers.Shared/Controls/TimePicker/TimePicker.cs
+++ b/src/WPFDevelopers.Shared/Controls/TimePicker/TimePicker.cs
@@ -129,7 +129,13 @@ private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
_timeSelector.SelectedTimeChanged -= TimeSelector_SelectedTimeChanged;
if (DateTime.TryParse(_textBox.Text, out var dateTime))
{
- if (SelectedTime.HasValue && dateTime.ToString(SelectedTimeFormat) == SelectedTime.Value.ToString(SelectedTimeFormat)) return;
+ if (SelectedTime.HasValue
+ &&
+ dateTime.ToString(SelectedTimeFormat) == SelectedTime.Value.ToString(SelectedTimeFormat))
+ {
+ _timeSelector.SelectedTimeChanged += TimeSelector_SelectedTimeChanged;
+ return;
+ }
SelectedTime = dateTime;
}
else
diff --git a/src/WPFDevelopers.Shared/Controls/TitleBarMode.cs b/src/WPFDevelopers.Shared/Controls/TitleBarMode.cs
new file mode 100644
index 00000000..5aeff750
--- /dev/null
+++ b/src/WPFDevelopers.Shared/Controls/TitleBarMode.cs
@@ -0,0 +1,8 @@
+namespace WPFDevelopers.Controls
+{
+ public enum TitleBarMode
+ {
+ Normal,
+ HighTitleBar
+ }
+}
diff --git a/src/WPFDevelopers.Shared/Core/Helpers/ControlsHelper.cs b/src/WPFDevelopers.Shared/Core/Helpers/ControlsHelper.cs
index 1748c7c6..3c3df174 100644
--- a/src/WPFDevelopers.Shared/Core/Helpers/ControlsHelper.cs
+++ b/src/WPFDevelopers.Shared/Core/Helpers/ControlsHelper.cs
@@ -88,7 +88,7 @@ public static void ThemeRefresh()
public static void WindowShake(Window window = null)
{
if (window == null)
- if (Application.Current.Windows.Count > 0)
+ if (Application.Current != null && Application.Current.Windows.Count > 0)
window = Application.Current.Windows.OfType().FirstOrDefault(o => o.IsActive);
var doubleAnimation = new DoubleAnimation
@@ -155,22 +155,26 @@ public static BitmapSource Capture()
}
return null;
}
+
public static AdornerLayer GetAdornerLayer(Visual visual)
{
- var decorator = visual as AdornerDecorator;
- if (decorator != null)
+ if (visual == null) return null;
+ if (visual is AdornerDecorator decorator)
return decorator.AdornerLayer;
- var presenter = visual as ScrollContentPresenter;
- if (presenter != null)
+ if (visual is ScrollContentPresenter presenter)
return presenter.AdornerLayer;
- var visualContent = (visual as Window)?.Content as Visual;
- return AdornerLayer.GetAdornerLayer(visualContent ?? visual);
+ if (visual is Window window)
+ {
+ var visualContent = window.Content as Visual;
+ return AdornerLayer.GetAdornerLayer(visualContent ?? visual);
+ }
+ return AdornerLayer.GetAdornerLayer(visual);
}
public static Window GetDefaultWindow()
{
Window window = null;
- if (Application.Current.Windows.Count > 0)
+ if (Application.Current != null && Application.Current.Windows.Count > 0)
{
window = Application.Current.Windows.OfType().FirstOrDefault(o => o.IsActive);
if (window == null)
diff --git a/src/WPFDevelopers.Shared/Core/Helpers/ElementHelper.cs b/src/WPFDevelopers.Shared/Core/Helpers/ElementHelper.cs
index f040e1ea..ea877d62 100644
--- a/src/WPFDevelopers.Shared/Core/Helpers/ElementHelper.cs
+++ b/src/WPFDevelopers.Shared/Core/Helpers/ElementHelper.cs
@@ -93,14 +93,17 @@ private static void ButtonClear_Click(object sender, RoutedEventArgs e)
if (sender is Button button)
{
if (button.TemplatedParent is TextBox textBox)
- {
textBox.Clear();
- }
else if (button.TemplatedParent is PasswordBox passwordBox)
- {
passwordBox.Clear();
+ else if (button.TemplatedParent is TabItem tabItem)
+ {
+ var tabControl = tabItem.Parent as TabControl;
+ if (tabControl != null)
+ tabControl.Items.Remove(tabItem);
}
}
}
+
}
}
\ No newline at end of file
diff --git a/src/WPFDevelopers.Shared/Core/Helpers/Helper.cs b/src/WPFDevelopers.Shared/Core/Helpers/Helper.cs
index 9f14935a..256d0a92 100644
--- a/src/WPFDevelopers.Shared/Core/Helpers/Helper.cs
+++ b/src/WPFDevelopers.Shared/Core/Helpers/Helper.cs
@@ -13,6 +13,7 @@ public class Helper
{
public const int WM_USER = 0x03FC;
public const int MY_MESSAGE = WM_USER + 1;
+ public const int MY_MESSAGEFULLPATH = MY_MESSAGE + 1;
public static string GetTempPath = Path.Combine(Path.GetTempPath(), Assembly.GetExecutingAssembly().GetName().Name);
public static string GetTempPathVersion = Path.Combine(GetTempPath, GetMD5Hash(GetCurrentDllPath()));
public const string GetExtName = "WPFDevelopersExt.exe";
diff --git a/src/WPFDevelopers.Shared/GZ/WPFDevelopersExt.exe.gz b/src/WPFDevelopers.Shared/GZ/WPFDevelopersExt.exe.gz
index 797662bf..e1270d62 100644
Binary files a/src/WPFDevelopers.Shared/GZ/WPFDevelopersExt.exe.gz and b/src/WPFDevelopers.Shared/GZ/WPFDevelopersExt.exe.gz differ
diff --git a/src/WPFDevelopers.Shared/LanguageManager.cs b/src/WPFDevelopers.Shared/LanguageManager.cs
index a14e863a..c79c450e 100644
--- a/src/WPFDevelopers.Shared/LanguageManager.cs
+++ b/src/WPFDevelopers.Shared/LanguageManager.cs
@@ -9,13 +9,29 @@ namespace WPFDevelopers
public class LanguageManager : INotifyPropertyChanged
{
private readonly ResourceManager _resourceManager;
+#pragma warning disable CA1416
private static readonly Lazy _lazy = new Lazy(() => new LanguageManager());
+#pragma warning restore CA1416
+ private CultureInfo _currentCulture;
public static LanguageManager Instance => _lazy.Value;
public event PropertyChangedEventHandler PropertyChanged;
+ public CultureInfo CurrentCulture
+ {
+ get => _currentCulture;
+ private set
+ {
+ if (_currentCulture != value)
+ {
+ _currentCulture = value;
+ OnPropertyChanged(nameof(CurrentCulture));
+ }
+ }
+ }
public LanguageManager()
{
_resourceManager = new ResourceManager("WPFDevelopers.Languages.Language", typeof(LanguageManager).Assembly);
+ _currentCulture = Thread.CurrentThread.CurrentUICulture ?? CultureInfo.InvariantCulture;
}
public string this[string name]
@@ -34,6 +50,7 @@ public void ChangeLanguage(CultureInfo cultureInfo)
{
Thread.CurrentThread.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureInfo;
+ CurrentCulture = cultureInfo;
OnPropertyChanged("Item[]");
}
protected virtual void OnPropertyChanged(string propertyName)
diff --git a/src/WPFDevelopers.Shared/Resources.cs b/src/WPFDevelopers.Shared/Resources.cs
index a99f389e..98499e69 100644
--- a/src/WPFDevelopers.Shared/Resources.cs
+++ b/src/WPFDevelopers.Shared/Resources.cs
@@ -12,13 +12,16 @@ namespace WPFDevelopers
public class Resources : ResourceDictionary
{
public static event ThemeChangedEvent ThemeChanged;
+ private ThemeType _theme;
public ThemeType Theme
{
+ get => _theme;
set => InitializeTheme(value);
}
protected void InitializeTheme(ThemeType themeType)
{
+ _theme = themeType;
MergedDictionaries.Clear();
var path = GetResourceUri(GetThemeResourceName(themeType));
MergedDictionaries.Add(new ResourceDictionary { Source = path });
diff --git a/src/WPFDevelopers.Shared/Styles/Styles.ComboBox.xaml b/src/WPFDevelopers.Shared/Styles/Styles.ComboBox.xaml
index d7f35b17..8d80c7dc 100644
--- a/src/WPFDevelopers.Shared/Styles/Styles.ComboBox.xaml
+++ b/src/WPFDevelopers.Shared/Styles/Styles.ComboBox.xaml
@@ -14,14 +14,14 @@
Padding="6,1.2"
BorderThickness="0"
SnapsToDevicePixels="true">
-
+
-
-
+
+
@@ -131,7 +131,11 @@
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{Binding Path=(helpers:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
SnapsToDevicePixels="True">
-
+
+
+
+
+
-
+
diff --git a/src/WPFDevelopers.Shared/Styles/Styles.GroupBox.xaml b/src/WPFDevelopers.Shared/Styles/Styles.GroupBox.xaml
index 00b3390d..b0cda945 100644
--- a/src/WPFDevelopers.Shared/Styles/Styles.GroupBox.xaml
+++ b/src/WPFDevelopers.Shared/Styles/Styles.GroupBox.xaml
@@ -12,36 +12,43 @@
BasedOn="{StaticResource WD.ControlBasicStyle}"
TargetType="{x:Type GroupBox}">
-
+
+
+
-
+
-
+
diff --git a/src/WPFDevelopers.Shared/Styles/Styles.Label.xaml b/src/WPFDevelopers.Shared/Styles/Styles.Label.xaml
index cc02bb9c..fb0b6918 100644
--- a/src/WPFDevelopers.Shared/Styles/Styles.Label.xaml
+++ b/src/WPFDevelopers.Shared/Styles/Styles.Label.xaml
@@ -11,8 +11,10 @@
x:Key="WD.DefaultLabel"
BasedOn="{StaticResource WD.ControlBasicStyle}"
TargetType="{x:Type Label}">
+
+
-
+
diff --git a/src/WPFDevelopers.Shared/Styles/Styles.TabControl.xaml b/src/WPFDevelopers.Shared/Styles/Styles.TabControl.xaml
index 03820288..50983671 100644
--- a/src/WPFDevelopers.Shared/Styles/Styles.TabControl.xaml
+++ b/src/WPFDevelopers.Shared/Styles/Styles.TabControl.xaml
@@ -2,7 +2,8 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFDevelopers.Controls"
- xmlns:helpers="clr-namespace:WPFDevelopers.Helpers">
+ xmlns:helpers="clr-namespace:WPFDevelopers.Helpers"
+ xmlns:resx="clr-namespace:WPFDevelopers">
@@ -19,15 +20,52 @@
-
+
-
+
+
+
+
+
+
+
+
+
@@ -38,6 +76,28 @@
+
+
+
+
@@ -85,7 +145,8 @@
+ #FF13CE67
+
+
#99FA68
diff --git a/src/WPFDevelopers.Shared/Themes/CircularMenu.xaml b/src/WPFDevelopers.Shared/Themes/CircleMenu.xaml
similarity index 92%
rename from src/WPFDevelopers.Shared/Themes/CircularMenu.xaml
rename to src/WPFDevelopers.Shared/Themes/CircleMenu.xaml
index 33631a28..a85d8065 100644
--- a/src/WPFDevelopers.Shared/Themes/CircularMenu.xaml
+++ b/src/WPFDevelopers.Shared/Themes/CircleMenu.xaml
@@ -8,12 +8,12 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/WPFDevelopers.Shared/Themes/CircleProgressBar.xaml b/src/WPFDevelopers.Shared/Themes/CircleProgressBar.xaml
new file mode 100644
index 00000000..4b4037bb
--- /dev/null
+++ b/src/WPFDevelopers.Shared/Themes/CircleProgressBar.xaml
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/WPFDevelopers.Shared/Themes/CircularProgressBar.xaml b/src/WPFDevelopers.Shared/Themes/CircularProgressBar.xaml
deleted file mode 100644
index d98ce31d..00000000
--- a/src/WPFDevelopers.Shared/Themes/CircularProgressBar.xaml
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/WPFDevelopers.Shared/Themes/DateRangePicker.xaml b/src/WPFDevelopers.Shared/Themes/DateRangePicker.xaml
index 0070cf1b..8c810d93 100644
--- a/src/WPFDevelopers.Shared/Themes/DateRangePicker.xaml
+++ b/src/WPFDevelopers.Shared/Themes/DateRangePicker.xaml
@@ -31,7 +31,7 @@
-
+
-
-
-
-
-
-
@@ -150,6 +144,8 @@