diff --git a/DotNet/WPF/Src/Core31/Panuon.UI.Silver/Panuon.UI.Silver.csproj b/DotNet/WPF/Src/Core31/Panuon.UI.Silver/Panuon.UI.Silver.csproj
index f6cc0462..7b0534e7 100644
--- a/DotNet/WPF/Src/Core31/Panuon.UI.Silver/Panuon.UI.Silver.csproj
+++ b/DotNet/WPF/Src/Core31/Panuon.UI.Silver/Panuon.UI.Silver.csproj
@@ -20,7 +20,9 @@
+
+
@@ -28,7 +30,9 @@
+
+
diff --git a/DotNet/WPF/Src/Core31/Panuon.UI.Silver/Resources/PanuonIcon.ttf b/DotNet/WPF/Src/Core31/Panuon.UI.Silver/Resources/PanuonIcon.ttf
new file mode 100644
index 00000000..f3224020
Binary files /dev/null and b/DotNet/WPF/Src/Core31/Panuon.UI.Silver/Resources/PanuonIcon.ttf differ
diff --git a/DotNet/WPF/Src/Core31/Panuon.UI.Silver/Resources/dropper.cur b/DotNet/WPF/Src/Core31/Panuon.UI.Silver/Resources/dropper.cur
new file mode 100644
index 00000000..febc577a
Binary files /dev/null and b/DotNet/WPF/Src/Core31/Panuon.UI.Silver/Resources/dropper.cur differ
diff --git a/DotNet/WPF/Src/Net40/Panuon.UI.Silver/Panuon.UI.Silver.csproj b/DotNet/WPF/Src/Net40/Panuon.UI.Silver/Panuon.UI.Silver.csproj
index ee2fc539..b74c36fa 100644
--- a/DotNet/WPF/Src/Net40/Panuon.UI.Silver/Panuon.UI.Silver.csproj
+++ b/DotNet/WPF/Src/Net40/Panuon.UI.Silver/Panuon.UI.Silver.csproj
@@ -69,6 +69,7 @@
SettingsSingleFileGenerator
Settings.Designer.cs
+
@@ -83,6 +84,9 @@
Panuon.UI.Core
+
+
+
diff --git a/DotNet/WPF/Src/Net40/Panuon.UI.Silver/Resources/PanuonIcon.ttf b/DotNet/WPF/Src/Net40/Panuon.UI.Silver/Resources/PanuonIcon.ttf
new file mode 100644
index 00000000..f3224020
Binary files /dev/null and b/DotNet/WPF/Src/Net40/Panuon.UI.Silver/Resources/PanuonIcon.ttf differ
diff --git a/DotNet/WPF/Src/Net40/Panuon.UI.Silver/Resources/dropper.cur b/DotNet/WPF/Src/Net40/Panuon.UI.Silver/Resources/dropper.cur
new file mode 100644
index 00000000..febc577a
Binary files /dev/null and b/DotNet/WPF/Src/Net40/Panuon.UI.Silver/Resources/dropper.cur differ
diff --git a/DotNet/WPF/Src/Net45/Panuon.UI.Core/Panuon.UI.Core.csproj b/DotNet/WPF/Src/Net45/Panuon.UI.Core/Panuon.UI.Core.csproj
index 86dfeeb4..591165e2 100644
--- a/DotNet/WPF/Src/Net45/Panuon.UI.Core/Panuon.UI.Core.csproj
+++ b/DotNet/WPF/Src/Net45/Panuon.UI.Core/Panuon.UI.Core.csproj
@@ -27,7 +27,7 @@
pdbonly
true
..\..\Outputs\Release\Net45\
- TRACE
+ TRACE;NET45
prompt
4
diff --git a/DotNet/WPF/Src/Net45/Panuon.UI.Silver/Panuon.UI.Silver.csproj b/DotNet/WPF/Src/Net45/Panuon.UI.Silver/Panuon.UI.Silver.csproj
index dc763359..9768053e 100644
--- a/DotNet/WPF/Src/Net45/Panuon.UI.Silver/Panuon.UI.Silver.csproj
+++ b/DotNet/WPF/Src/Net45/Panuon.UI.Silver/Panuon.UI.Silver.csproj
@@ -27,7 +27,7 @@
pdbonly
true
..\..\Outputs\Release\Net45\
- TRACE
+ TRACE;NET45
prompt
4
@@ -66,6 +66,7 @@
SettingsSingleFileGenerator
Settings.Designer.cs
+
@@ -80,6 +81,9 @@
Panuon.UI.Core
+
+
+
diff --git a/DotNet/WPF/Src/Net45/Panuon.UI.Silver/Resources/PanuonIcon.ttf b/DotNet/WPF/Src/Net45/Panuon.UI.Silver/Resources/PanuonIcon.ttf
new file mode 100644
index 00000000..f3224020
Binary files /dev/null and b/DotNet/WPF/Src/Net45/Panuon.UI.Silver/Resources/PanuonIcon.ttf differ
diff --git a/DotNet/WPF/Src/Net45/Panuon.UI.Silver/Resources/dropper.cur b/DotNet/WPF/Src/Net45/Panuon.UI.Silver/Resources/dropper.cur
new file mode 100644
index 00000000..febc577a
Binary files /dev/null and b/DotNet/WPF/Src/Net45/Panuon.UI.Silver/Resources/dropper.cur differ
diff --git a/DotNet/WPF/Src/Net472/Panuon.UI.Silver/Panuon.UI.Silver.csproj b/DotNet/WPF/Src/Net472/Panuon.UI.Silver/Panuon.UI.Silver.csproj
index 208e892a..0897a026 100644
--- a/DotNet/WPF/Src/Net472/Panuon.UI.Silver/Panuon.UI.Silver.csproj
+++ b/DotNet/WPF/Src/Net472/Panuon.UI.Silver/Panuon.UI.Silver.csproj
@@ -72,6 +72,7 @@
SettingsSingleFileGenerator
Settings.Designer.cs
+
@@ -80,6 +81,9 @@
Panuon.UI.Core
+
+
+
diff --git a/DotNet/WPF/Src/Net472/Panuon.UI.Silver/Resources/PanuonIcon.ttf b/DotNet/WPF/Src/Net472/Panuon.UI.Silver/Resources/PanuonIcon.ttf
new file mode 100644
index 00000000..f3224020
Binary files /dev/null and b/DotNet/WPF/Src/Net472/Panuon.UI.Silver/Resources/PanuonIcon.ttf differ
diff --git a/DotNet/WPF/Src/Net472/Panuon.UI.Silver/Resources/dropper.cur b/DotNet/WPF/Src/Net472/Panuon.UI.Silver/Resources/dropper.cur
new file mode 100644
index 00000000..febc577a
Binary files /dev/null and b/DotNet/WPF/Src/Net472/Panuon.UI.Silver/Resources/dropper.cur differ
diff --git a/DotNet/WPF/Src/Samples/App.xaml b/DotNet/WPF/Src/Samples/App.xaml
index 29195441..2bf9827c 100644
--- a/DotNet/WPF/Src/Samples/App.xaml
+++ b/DotNet/WPF/Src/Samples/App.xaml
@@ -11,6 +11,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/DotNet/WPF/Src/Samples/Views/Examples/FormView.xaml.cs b/DotNet/WPF/Src/Samples/Views/Examples/FormView.xaml.cs
index b5afc2ad..125619af 100644
--- a/DotNet/WPF/Src/Samples/Views/Examples/FormView.xaml.cs
+++ b/DotNet/WPF/Src/Samples/Views/Examples/FormView.xaml.cs
@@ -1,4 +1,5 @@
using Panuon.UI.Silver;
+using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
@@ -22,23 +23,28 @@ public FormView()
#endregion
#region Event Handlers
- private void BtnContinue_Click(object sender, RoutedEventArgs e)
+ protected override void OnClosing(CancelEventArgs e)
{
- if (_isProcessing)
+ //Press Continue Button
+ if (DialogResult == true)
{
- return;
+ if (_isProcessing)
+ {
+ e.Cancel = true;
+ return;
+ }
+ if (!ValidateForm())
+ {
+ e.Cancel = true;
+ return;
+ }
+ _isProcessing = true;
+ var okButton = WindowXModalDialog.GetOKButton(this);
+ ButtonHelper.SetIsPending(okButton, true);
+ e.Cancel = true;
}
- if (!ValidateForm())
- {
- return;
- }
- _isProcessing = true;
- ButtonHelper.SetIsPending(BtnContinue, true);
- }
- private void BtnCancel_Click(object sender, RoutedEventArgs e)
- {
- Close();
+ base.OnClosing(e);
}
#endregion
@@ -47,21 +53,21 @@ private bool ValidateForm()
{
if (string.IsNullOrEmpty(TbName.Text))
{
- FrmName.ValidateResult = ValidateResult.Error;
- FrmName.Message = "Input your name.";
+ FmgrpName.ValidateResult = ValidateResult.Error;
+ FmgrpName.Message = "Input your name.";
return false;
}
- FrmName.ValidateResult = ValidateResult.None;
- FrmName.Message = null;
+ FmgrpName.ValidateResult = ValidateResult.None;
+ FmgrpName.Message = null;
if (ChbAgreement.IsChecked != true)
{
- FrmOptions.ValidateResult = ValidateResult.Error;
- FrmOptions.Message = "Check option(s).";
+ FmgrpOptions.ValidateResult = ValidateResult.Error;
+ FmgrpOptions.Message = "Check option(s).";
return false;
}
- FrmOptions.ValidateResult = ValidateResult.None;
- FrmOptions.Message = null;
+ FmgrpOptions.ValidateResult = ValidateResult.None;
+ FmgrpOptions.Message = null;
return true;
}
#endregion
diff --git a/DotNet/WPF/Src/Samples/Views/Examples/NeteaseMusicView.xaml b/DotNet/WPF/Src/Samples/Views/Examples/NeteaseMusicView.xaml
index f7ea1d99..2159925a 100644
--- a/DotNet/WPF/Src/Samples/Views/Examples/NeteaseMusicView.xaml
+++ b/DotNet/WPF/Src/Samples/Views/Examples/NeteaseMusicView.xaml
@@ -143,7 +143,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ColorSelectorStyle.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ColorSelectorStyle.xaml
new file mode 100644
index 00000000..afd2bdef
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ColorSelectorStyle.xaml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ComboBoxStyle.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ComboBoxStyle.xaml
index 74bdcea4..e17b6226 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ComboBoxStyle.xaml
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ComboBoxStyle.xaml
@@ -31,7 +31,7 @@
+ Value="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
+ Value="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
+
+
+
+
+
+
+
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ThumbStyle.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ThumbStyle.xaml
new file mode 100644
index 00000000..4357d278
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ThumbStyle.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/WindowXStyle.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/WindowXStyle.xaml
index c8652e42..63f21440 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/WindowXStyle.xaml
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/WindowXStyle.xaml
@@ -10,8 +10,25 @@
+
-
-
-
-
+
@@ -151,13 +168,13 @@
+ Value="{StaticResource {ComponentResourceKey ResourceId=HeaderTemplate, TypeInTargetAssembly={x:Type local:WindowXCaption}}}" />
+ Value="{StaticResource {ComponentResourceKey ResourceId=MinimizeButtonStyle, TypeInTargetAssembly={x:Type local:WindowXCaption}}}" />
+ Value="{StaticResource {ComponentResourceKey ResourceId=MaximizeButtonStyle, TypeInTargetAssembly={x:Type local:WindowXCaption}}}" />
+ Value="{StaticResource {ComponentResourceKey ResourceId=CloseButtonStyle, TypeInTargetAssembly={x:Type local:WindowXCaption}}}" />
+
+
_imageFileFormats = new List()
+ {
+ ".bmp", ".jpg", ".jpe", ".jpeg", ".gif", ".tif", ".ico"
+ };
+
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
if (item != null)
@@ -20,21 +24,10 @@ public override DataTemplate SelectTemplate(object item, DependencyObject contai
}
else if (item is string stringItem)
{
- try
+ if(_imageFileFormats.Any(x => stringItem.EndsWith(x)))
{
- new ResourceDictionary()
- {
- Source = new Uri(stringItem, UriKind.RelativeOrAbsolute),
- };
return CreateImageDataTemplate(item);
}
- catch (Exception ex)
- {
- if (!(ex is FileNotFoundException || ex is IOException))
- {
- return CreateImageDataTemplate(item);
- }
- }
}
}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ColorPickerTemplate.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ColorPickerTemplate.xaml
new file mode 100644
index 00000000..9c816b73
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ColorPickerTemplate.xaml
@@ -0,0 +1,285 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ColorSelectorTemplate.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ColorSelectorTemplate.xaml
new file mode 100644
index 00000000..91c0439d
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ColorSelectorTemplate.xaml
@@ -0,0 +1,193 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ContentControlXTemplate.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ContentControlXTemplate.xaml
index f1d1fcd2..9f6d3fa2 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ContentControlXTemplate.xaml
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ContentControlXTemplate.xaml
@@ -12,8 +12,9 @@
-
@@ -58,11 +59,6 @@
-
-
-
-
@@ -132,7 +90,7 @@
+ Style="{Binding Path=(local:SliderHelper.ThumbStyle), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
+ Style="{Binding Path=(local:SliderHelper.ThumbStyle), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ThumbTemplate.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ThumbTemplate.xaml
new file mode 100644
index 00000000..7c62c4a9
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ThumbTemplate.xaml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/WindowXTemplate.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/WindowXTemplate.xaml
index bd3a7939..684add1f 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/WindowXTemplate.xaml
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/WindowXTemplate.xaml
@@ -21,8 +21,40 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/ColorUtil.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/ColorUtil.cs
new file mode 100644
index 00000000..408763e5
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/ColorUtil.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Windows.Media;
+
+namespace Panuon.UI.Silver.Internal.Utils
+{
+ static class ColorUtil
+ {
+ #region Methods
+ public static Color GetScreenColor(double x, double y)
+ {
+ var hwnd = Win32Util.GetDC(IntPtr.Zero);
+ var pixel = Win32Util.GetPixel(hwnd, (int)x, (int)y);
+ Win32Util.ReleaseDC(IntPtr.Zero, hwnd);
+ return Color.FromRgb((byte)(pixel & 0x000000FF),
+ (byte)((pixel & 0x0000FF00) >> 8),
+ (byte)((pixel & 0x00FF0000) >> 16));
+ }
+
+ public static string ToHEXString(Color color, bool includeAlpha, bool includeTag)
+ {
+ var colorString = includeAlpha
+ ? string.Format("{0:X2}{1:X2}{2:X2}{3:X2}", color.A, color.R, color.G, color.B)
+ : string.Format("{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B);
+ if (includeTag)
+ {
+ colorString = "#" + colorString;
+ }
+ return colorString;
+ }
+
+ public static Color? FromHEXString(string text)
+ {
+ try
+ {
+ if (!text.StartsWith("#"))
+ {
+ text = "#" + text;
+ }
+ return (Color)ColorConverter.ConvertFromString(text);
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ internal static string ToARGBString(Color color, bool includeAlpha)
+ {
+ var colorString = includeAlpha
+ ? string.Format("{0}, {1}, {2}, {3}", color.A, color.R, color.G, color.B)
+ : string.Format("{0}, {1}, {2}", color.R, color.G, color.B);
+ return colorString;
+ }
+
+ public static Color? FromARGBString(string text)
+ {
+ try
+ {
+ text = text.Replace(" ", "");
+ var argbs = text.Split(',');
+ if(argbs.Length == 3)
+ {
+ if(byte.TryParse(argbs[0], out byte r)
+ && byte.TryParse(argbs[1], out byte g)
+ && byte.TryParse(argbs[2], out byte b))
+ {
+ return Color.FromArgb(255, r, g, b);
+ }
+ }
+ else if(argbs.Length == 4)
+ {
+ if (byte.TryParse(argbs[0], out byte a)
+ && byte.TryParse(argbs[1], out byte r)
+ && byte.TryParse(argbs[2], out byte g)
+ && byte.TryParse(argbs[3], out byte b))
+ {
+ return Color.FromArgb(a, r, g, b);
+ }
+ }
+ return null;
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/CursorUtil.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/CursorUtil.cs
new file mode 100644
index 00000000..08d6122b
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/CursorUtil.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Windows;
+using System.Windows.Input;
+
+namespace Panuon.UI.Silver.Internal.Utils
+{
+ static class CursorUtil
+ {
+ #region Properties
+ public static Cursor DropperCursor
+ {
+ get
+ {
+ if(_dropperCursor == null)
+ {
+ var info = Application.GetResourceStream(new Uri("/Panuon.UI.Silver;component/Resources/dropper.cur", UriKind.Relative));
+#if NET40
+ _dropperCursor = new Cursor(info.Stream);
+#elif NET45
+ _dropperCursor = new Cursor(info.Stream);
+#else
+ _dropperCursor = new Cursor(info.Stream, true);
+#endif
+ }
+ return _dropperCursor;
+ }
+ }
+ private static Cursor _dropperCursor;
+#endregion
+ }
+}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/Win32Util.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/Win32Util.cs
index 76012c0c..ac12ef37 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/Win32Util.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/Win32Util.cs
@@ -65,11 +65,16 @@ internal enum WindowCompositionAttribute
internal static extern int SetWindowLong(IntPtr hwnd, int index, int newStyle);
[DllImport("user32.dll")]
- internal static extern int GetDpiForWindow(IntPtr hwnd);
+ internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
[DllImport("user32.dll")]
- internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
+ internal static extern IntPtr GetDC(IntPtr hwnd);
+
+ [DllImport("user32.dll")]
+ internal static extern Int32 ReleaseDC(IntPtr hwnd, IntPtr hdc);
+ [DllImport("gdi32.dll")]
+ internal static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos);
#endregion
}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Configurations/MessageBoxXSetting.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Configurations/MessageBoxXSetting.cs
index 15cef5be..731f5f3d 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Configurations/MessageBoxXSetting.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Configurations/MessageBoxXSetting.cs
@@ -24,8 +24,6 @@ public bool InverseButtonsSequence
public static readonly DependencyProperty InverseButtonsSequenceProperty =
DependencyProperty.Register("InverseButtonsSequence", typeof(bool), typeof(MessageBoxXSetting));
-
-
#endregion
#region ButtonStyle
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Control.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Control.xaml
index 74b5ed49..b38b6c75 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Control.xaml
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Control.xaml
@@ -34,6 +34,7 @@
+
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/ColorPicker.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/ColorPicker.cs
new file mode 100644
index 00000000..3a17d706
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/ColorPicker.cs
@@ -0,0 +1,631 @@
+using Panuon.UI.Core;
+using Panuon.UI.Silver.Internal;
+using Panuon.UI.Silver.Internal.Utils;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Threading;
+
+namespace Panuon.UI.Silver
+{
+ [TemplatePart(Name = ColorSelectorTemplateName, Type = typeof(ColorSelector))]
+ [TemplatePart(Name = EditableTextBoxTemplateName, Type = typeof(TextBox))]
+ public class ColorPicker : Control
+ {
+ #region Fields
+ private const string ColorSelectorTemplateName = "PART_ColorSelector";
+
+ private const string EditableTextBoxTemplateName = "PART_EditableTextBox";
+
+ private const string PopupTemplateName = "PART_Popup";
+
+ private ColorSelector _colorSelector;
+
+ private TextBox _editableTextBox;
+
+ private bool _isInternalUpdateColorSelector;
+
+ private bool _isInternalUpdateTextBox;
+ #endregion
+
+ #region Ctor
+ static ColorPicker()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(ColorPicker), new FrameworkPropertyMetadata(typeof(ColorPicker)));
+
+ EventManager.RegisterClassHandler(typeof(ColorPicker), Mouse.LostMouseCaptureEvent, new MouseEventHandler(OnLostMouseCapture));
+ EventManager.RegisterClassHandler(typeof(ColorPicker), Mouse.MouseDownEvent, new MouseButtonEventHandler(OnMouseButtonDown));
+ EventManager.RegisterClassHandler(typeof(ColorPicker), Mouse.PreviewMouseDownEvent, new MouseButtonEventHandler(OnPreviewMouseButtonDown));
+ EventManager.RegisterClassHandler(typeof(ColorPicker), UIElement.GotFocusEvent, new RoutedEventHandler(OnThisGotFocus));
+ }
+ #endregion
+
+ #region Events
+
+ #region SelectedColorChanged
+ public event SelectedValueChangedEventHandler SelectedColorChanged
+ {
+ add { AddHandler(SelectedColorChangedEvent, value); }
+ remove { RemoveHandler(SelectedColorChangedEvent, value); }
+ }
+
+ public static readonly RoutedEvent SelectedColorChangedEvent =
+ EventManager.RegisterRoutedEvent("SelectedColorChanged", RoutingStrategy.Bubble, typeof(SelectedValueChangedEventHandler), typeof(ColorPicker));
+ #endregion
+
+ #endregion
+
+ #region Properties
+
+ #region Icon
+ public object Icon
+ {
+ get { return (object)GetValue(IconProperty); }
+ set { SetValue(IconProperty, value); }
+ }
+
+ public static readonly DependencyProperty IconProperty =
+ DependencyProperty.Register("Icon", typeof(object), typeof(ColorPicker));
+ #endregion
+
+ #region CornerRadius
+ public CornerRadius CornerRadius
+ {
+ get { return (CornerRadius)GetValue(CornerRadiusProperty); }
+ set { SetValue(CornerRadiusProperty, value); }
+ }
+
+ public static readonly DependencyProperty CornerRadiusProperty =
+ DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(ColorPicker));
+ #endregion
+
+ #region Watermark
+ public string Watermark
+ {
+ get { return (string)GetValue(WatermarkProperty); }
+ set { SetValue(WatermarkProperty, value); }
+ }
+
+ public static readonly DependencyProperty WatermarkProperty =
+ DependencyProperty.Register("Watermark", typeof(string), typeof(ColorPicker));
+ #endregion
+
+ #region WatermarkBrush
+ public Brush WatermarkBrush
+ {
+ get { return (Brush)GetValue(WatermarkBrushProperty); }
+ set { SetValue(WatermarkBrushProperty, value); }
+ }
+
+ public static readonly DependencyProperty WatermarkBrushProperty =
+ DependencyProperty.Register("WatermarkBrush", typeof(Brush), typeof(ColorPicker));
+ #endregion
+
+ #region HoverBackground
+ public Brush HoverBackground
+ {
+ get { return (Brush)GetValue(HoverBackgroundProperty); }
+ set { SetValue(HoverBackgroundProperty, value); }
+ }
+
+ public static readonly DependencyProperty HoverBackgroundProperty =
+ VisualStateHelper.HoverBackgroundProperty.AddOwner(typeof(ColorPicker));
+ #endregion
+
+ #region HoverForeground
+ public Brush HoverForeground
+ {
+ get { return (Brush)GetValue(HoverForegroundProperty); }
+ set { SetValue(HoverForegroundProperty, value); }
+ }
+
+ public static readonly DependencyProperty HoverForegroundProperty =
+ VisualStateHelper.HoverForegroundProperty.AddOwner(typeof(ColorPicker));
+ #endregion
+
+ #region HoverBorderBrush
+ public Brush HoverBorderBrush
+ {
+ get { return (Brush)GetValue(HoverBorderBrushProperty); }
+ set { SetValue(HoverBorderBrushProperty, value); }
+ }
+
+ public static readonly DependencyProperty HoverBorderBrushProperty =
+ VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(ColorPicker));
+ #endregion
+
+ #region HoverShadowColor
+ public Color? HoverShadowColor
+ {
+ get { return (Color?)GetValue(HoverShadowColorProperty); }
+ set { SetValue(HoverShadowColorProperty, value); }
+ }
+
+ public static readonly DependencyProperty HoverShadowColorProperty =
+ VisualStateHelper.HoverShadowColorProperty.AddOwner(typeof(ColorPicker));
+ #endregion
+
+ #region FocusedBackground
+ public Brush FocusedBackground
+ {
+ get { return (Brush)GetValue(FocusedBackgroundProperty); }
+ set { SetValue(FocusedBackgroundProperty, value); }
+ }
+
+ public static readonly DependencyProperty FocusedBackgroundProperty =
+ VisualStateHelper.FocusedBackgroundProperty.AddOwner(typeof(ColorPicker));
+ #endregion
+
+ #region FocusedForeground
+ public Brush FocusedForeground
+ {
+ get { return (Brush)GetValue(FocusedForegroundProperty); }
+ set { SetValue(FocusedForegroundProperty, value); }
+ }
+
+ public static readonly DependencyProperty FocusedForegroundProperty =
+ VisualStateHelper.FocusedForegroundProperty.AddOwner(typeof(ColorPicker));
+ #endregion
+
+ #region FocusedBorderBrush
+ public Brush FocusedBorderBrush
+ {
+ get { return (Brush)GetValue(FocusedBorderBrushProperty); }
+ set { SetValue(FocusedBorderBrushProperty, value); }
+ }
+
+ public static readonly DependencyProperty FocusedBorderBrushProperty =
+ VisualStateHelper.FocusedBorderBrushProperty.AddOwner(typeof(ColorPicker));
+ #endregion
+
+ #region FocusedShadowColor
+ public Color? FocusedShadowColor
+ {
+ get { return (Color?)GetValue(FocusedShadowColorProperty); }
+ set { SetValue(FocusedShadowColorProperty, value); }
+ }
+
+ public static readonly DependencyProperty FocusedShadowColorProperty =
+ VisualStateHelper.FocusedShadowColorProperty.AddOwner(typeof(ColorPicker));
+ #endregion
+
+ #region FocusedWatermarkBrush
+ public Brush FocusedWatermarkBrush
+ {
+ get { return (Brush)GetValue(FocusedWatermarkBrushProperty); }
+ set { SetValue(FocusedWatermarkBrushProperty, value); }
+ }
+
+ public static readonly DependencyProperty FocusedWatermarkBrushProperty =
+ VisualStateHelper.FocusedWatermarkBrushProperty.AddOwner(typeof(ColorPicker));
+ #endregion
+
+ #region Text
+ public string Text
+ {
+ get { return (string)GetValue(TextProperty); }
+ set { SetValue(TextProperty, value); }
+ }
+
+ public static readonly DependencyProperty TextProperty =
+ DependencyProperty.Register("Text", typeof(string), typeof(ColorPicker));
+ #endregion
+
+ #region TextFormats
+ public ColorTextFormats ColorTextFormats
+ {
+ get { return (ColorTextFormats)GetValue(TextFormatsProperty); }
+ set { SetValue(TextFormatsProperty, value); }
+ }
+
+ public static readonly DependencyProperty TextFormatsProperty =
+ DependencyProperty.Register("TextFormats", typeof(ColorTextFormats), typeof(ColorPicker), new PropertyMetadata(ColorTextFormats.HEX, OnColorTextFormatsChanged));
+ #endregion
+
+ #region IsDropDownOpen
+ public bool IsDropDownOpen
+ {
+ get { return (bool)GetValue(IsDropDownOpenProperty); }
+ set { SetValue(IsDropDownOpenProperty, value); }
+ }
+
+ public static readonly DependencyProperty IsDropDownOpenProperty =
+ DependencyProperty.Register("IsDropDownOpen", typeof(bool), typeof(ColorPicker), new PropertyMetadata(OnIsDropDownOpenChanged));
+ #endregion
+
+ #region IsEditable
+ public bool IsEditable
+ {
+ get { return (bool)GetValue(IsEditableProperty); }
+ set { SetValue(IsEditableProperty, value); }
+ }
+
+ public static readonly DependencyProperty IsEditableProperty =
+ DependencyProperty.Register("IsEditable", typeof(bool), typeof(ColorPicker));
+ #endregion
+
+ #region StaysOpen
+ public bool StaysOpen
+ {
+ get { return (bool)GetValue(StaysOpenProperty); }
+ set { SetValue(StaysOpenProperty, value); }
+ }
+
+ public static readonly DependencyProperty StaysOpenProperty =
+ DependencyProperty.Register("StaysOpen", typeof(bool), typeof(ColorPicker));
+ #endregion
+
+ #region ColorChannels
+ public ColorChannels ColorChannels
+ {
+ get { return (ColorChannels)GetValue(ColorChannelsProperty); }
+ set { SetValue(ColorChannelsProperty, value); }
+ }
+
+ public static readonly DependencyProperty ColorChannelsProperty =
+ DependencyProperty.Register("ColorChannels", typeof(ColorChannels), typeof(ColorPicker), new PropertyMetadata(ColorChannels.ARGB, OnColorChannelsChanged));
+
+ #endregion
+
+ #region SelectedColor
+ public Color? SelectedColor
+ {
+ get { return (Color?)GetValue(SelectedColorProperty); }
+ set { SetValue(SelectedColorProperty, value); }
+ }
+
+ public static readonly DependencyProperty SelectedColorProperty =
+ DependencyProperty.Register("SelectedColor", typeof(Color?), typeof(ColorPicker), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnSelectedColorChanged));
+
+ #endregion
+
+ #region DefaultColor
+ public Color? DefaultColor
+ {
+ get { return (Color?)GetValue(DefaultColorProperty); }
+ set { SetValue(DefaultColorProperty, value); }
+ }
+
+ public static readonly DependencyProperty DefaultColorProperty =
+ DependencyProperty.Register("DefaultColor", typeof(Color?), typeof(ColorPicker), new PropertyMetadata(null));
+ #endregion
+
+ #region ColorSelectorStyle
+ public Style ColorSelectorStyle
+ {
+ get { return (Style)GetValue(ColorSelectorStyleProperty); }
+ set { SetValue(ColorSelectorStyleProperty, value); }
+ }
+
+ public static readonly DependencyProperty ColorSelectorStyleProperty =
+ DependencyProperty.Register("ColorSelectorStyle", typeof(Style), typeof(ColorPicker));
+ #endregion
+
+ #region ToggleArrowTransformControlStyle
+ public Style ToggleArrowTransformControlStyle
+ {
+ get { return (Style)GetValue(ToggleArrowTransformControlStyleProperty); }
+ set { SetValue(ToggleArrowTransformControlStyleProperty, value); }
+ }
+
+ public static readonly DependencyProperty ToggleArrowTransformControlStyleProperty =
+ DependencyProperty.Register("ToggleArrowTransformControlStyle", typeof(Style), typeof(ColorPicker));
+ #endregion
+
+ #region PreviewTemplate
+ public DataTemplate PreviewTemplate
+ {
+ get { return (DataTemplate)GetValue(PreviewTemplateProperty); }
+ set { SetValue(PreviewTemplateProperty, value); }
+ }
+
+ public static readonly DependencyProperty PreviewTemplateProperty =
+ DependencyProperty.Register("PreviewTemplate", typeof(DataTemplate), typeof(ColorPicker));
+ #endregion
+
+ #region ClearButtonStyle
+ public Style ClearButtonStyle
+ {
+ get { return (Style)GetValue(ClearButtonStyleProperty); }
+ set { SetValue(ClearButtonStyleProperty, value); }
+ }
+
+ public static readonly DependencyProperty ClearButtonStyleProperty =
+ DependencyProperty.Register("ClearButtonStyle", typeof(Style), typeof(ColorPicker));
+ #endregion
+
+ #region ClearButtonVisibility
+ public AuxiliaryButtonVisibility ClearButtonVisibility
+ {
+ get { return (AuxiliaryButtonVisibility)GetValue(ClearButtonVisibilityProperty); }
+ set { SetValue(ClearButtonVisibilityProperty, value); }
+ }
+
+ public static readonly DependencyProperty ClearButtonVisibilityProperty =
+ DependencyProperty.Register("ClearButtonVisibility", typeof(AuxiliaryButtonVisibility), typeof(ColorPicker));
+ #endregion
+
+ #region ClearCommand
+ internal ICommand ClearCommand
+ {
+ get { return (ICommand)GetValue(ClearCommandProperty); }
+ }
+
+ internal static readonly DependencyPropertyKey ClearCommandPropertyKey =
+ DependencyProperty.RegisterReadOnly("ClearCommand", typeof(ICommand), typeof(ColorPicker), new PropertyMetadata(new RelayCommand(OnClearCommandExecute)));
+
+ public static readonly DependencyProperty ClearCommandProperty =
+ ClearCommandPropertyKey.DependencyProperty;
+ #endregion
+
+ #endregion
+
+ #region Overrides
+ public override void OnApplyTemplate()
+ {
+ _colorSelector = GetTemplateChild(ColorSelectorTemplateName) as ColorSelector;
+ _colorSelector.SelectedColorChanged += ColorSelector_SelectedColorChanged;
+
+ _editableTextBox = GetTemplateChild(EditableTextBoxTemplateName) as TextBox;
+ _editableTextBox.TextChanged += EditableTextBox_TextChanged;
+
+ UpdateColorSelectorSelectedColor();
+ UpdateText();
+ }
+ #endregion
+
+ #region Event Handlers
+ private static void OnColorTextFormatsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var colorPicker = (ColorPicker)d;
+ colorPicker.UpdateText();
+ }
+
+ private static void OnColorChannelsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var colorPicker = (ColorPicker)d;
+ colorPicker.UpdateText();
+ }
+
+ private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var colorPicker = (ColorPicker)d;
+ if ((bool)e.NewValue)
+ {
+ Mouse.Capture(colorPicker, CaptureMode.SubTree);
+ if (colorPicker.IsEditable
+ && colorPicker._editableTextBox != null)
+ {
+ colorPicker._editableTextBox.Focus();
+ }
+ }
+ else
+ {
+ if (colorPicker.IsKeyboardFocusWithin)
+ {
+ if (colorPicker.IsEditable)
+ {
+ if (colorPicker._editableTextBox != null
+ && !colorPicker._editableTextBox.IsKeyboardFocusWithin)
+ {
+ colorPicker.Focus();
+ }
+ }
+ else
+ {
+ colorPicker.Focus();
+ }
+ }
+ if (Mouse.Captured == colorPicker)
+ {
+ Mouse.Capture(null);
+ }
+ }
+ }
+
+ private static void OnThisGotFocus(object sender, RoutedEventArgs e)
+ {
+ var colorPicker = (ColorPicker)sender;
+ if (!e.Handled)
+ {
+ if (colorPicker.IsEditable && colorPicker._editableTextBox != null)
+ {
+ if (e.OriginalSource == colorPicker)
+ {
+ colorPicker._editableTextBox.Focus();
+ e.Handled = true;
+ }
+ else if (e.OriginalSource == colorPicker._editableTextBox)
+ {
+ colorPicker._editableTextBox.Focus();
+ }
+ }
+ }
+
+ }
+
+ private static void OnMouseButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ var colorPicker = (ColorPicker)sender;
+ if ((colorPicker.ContextMenu == null || !colorPicker.ContextMenu.IsOpen)
+ && !colorPicker.IsKeyboardFocusWithin)
+ {
+ colorPicker.Focus();
+ }
+
+ if (Mouse.Captured == colorPicker
+ && e.OriginalSource == colorPicker)
+ {
+ colorPicker.SetCurrentValue(IsDropDownOpenProperty, false);
+ }
+ }
+
+ private static void OnPreviewMouseButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ var colorPicker = (ColorPicker)sender;
+ if (colorPicker.IsEditable)
+ {
+ var originalSource = e.OriginalSource as Visual;
+
+ if (originalSource != null && colorPicker._editableTextBox != null
+ && colorPicker.IsAncestorOf(originalSource))
+ {
+ if ((colorPicker.ContextMenu == null || !colorPicker.ContextMenu.IsOpen)
+ && !colorPicker.IsKeyboardFocusWithin)
+ {
+ colorPicker.Focus();
+ }
+ }
+ }
+ }
+
+ private static void OnLostMouseCapture(object sender ,MouseEventArgs e)
+ {
+ var colorPicker = (ColorPicker)sender;
+ if(e.OriginalSource == colorPicker._editableTextBox)
+ {
+ colorPicker.SetCurrentValue(IsDropDownOpenProperty, true);
+ colorPicker._editableTextBox.Focus();
+ }
+ Debug.WriteLine(e.OriginalSource);
+ }
+
+ private static void OnSelectedColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var colorPicker = (ColorPicker)d;
+ colorPicker.UpdateColorSelectorSelectedColor();
+ colorPicker.UpdateText();
+ }
+
+ private void EditableTextBox_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ if (_isInternalUpdateTextBox)
+ {
+ return;
+ }
+
+ _isInternalUpdateTextBox = true;
+
+ UpdateSelectedColor();
+
+ _isInternalUpdateTextBox = false;
+ }
+
+ private static void OnClearCommandExecute(ColorPicker colorPicker)
+ {
+ colorPicker.SetCurrentValue(TextProperty, null);
+ colorPicker.SetCurrentValue(SelectedColorProperty, colorPicker.DefaultColor);
+ }
+
+ private void ColorSelector_SelectedColorChanged(object sender, SelectedValueChangedEventArgs e)
+ {
+ if (_isInternalUpdateColorSelector)
+ {
+ return;
+ }
+ _isInternalUpdateColorSelector = true;
+
+ SetCurrentValue(SelectedColorProperty, e.NewValue);
+
+ _isInternalUpdateColorSelector = false;
+ }
+ #endregion
+
+ #region Functions
+ private void UpdateColorSelectorSelectedColor()
+ {
+ if (_colorSelector == null
+ || _isInternalUpdateColorSelector)
+ {
+ return;
+ }
+
+ _isInternalUpdateColorSelector = true;
+
+ _colorSelector.SetCurrentValue(ColorSelector.SelectedColorProperty, SelectedColor ?? Colors.White);
+
+ _isInternalUpdateColorSelector = false;
+ }
+
+ private void UpdateText()
+ {
+ if(_editableTextBox == null)
+ {
+ return;
+ }
+
+ var nullableSelectedColor = SelectedColor;
+ string text = null;
+
+ if (nullableSelectedColor is Color selectedColor)
+ {
+ switch (ColorTextFormats)
+ {
+ case ColorTextFormats.HEX:
+ text = ColorUtil.ToHEXString(selectedColor, ColorChannels == ColorChannels.ARGB, true);
+ break;
+ case ColorTextFormats.ARGB:
+ text = ColorUtil.ToARGBString(selectedColor, ColorChannels == ColorChannels.ARGB);
+ break;
+
+ }
+ }
+
+ SetCurrentValue(TextProperty, text);
+
+ if (!_isInternalUpdateTextBox)
+ {
+ _isInternalUpdateTextBox = true;
+
+ _editableTextBox.Text = text;
+
+ _isInternalUpdateTextBox = false;
+ }
+ }
+
+ private void UpdateSelectedColor()
+ {
+ if (_editableTextBox == null)
+ {
+ return;
+ }
+
+ var text = _editableTextBox.Text;
+ var selectedColor = SelectedColor;
+
+ switch (ColorTextFormats)
+ {
+ case ColorTextFormats.HEX:
+ if (ColorUtil.FromHEXString(text) is Color newHexColor)
+ {
+ if (ColorChannels == ColorChannels.RGB)
+ {
+ newHexColor.A = 255;
+ }
+ selectedColor = newHexColor;
+ }
+ break;
+ case ColorTextFormats.ARGB:
+ if (ColorUtil.FromARGBString(text) is Color newARGBColor)
+ {
+ if (ColorChannels == ColorChannels.RGB)
+ {
+ newARGBColor.A = 255;
+ }
+ selectedColor = newARGBColor;
+ }
+ break;
+ }
+
+ SetCurrentValue(SelectedColorProperty, selectedColor);
+ }
+
+ #endregion
+ }
+}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/ColorSelector.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/ColorSelector.cs
new file mode 100644
index 00000000..39e46859
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/ColorSelector.cs
@@ -0,0 +1,660 @@
+using Panuon.UI.Core;
+using Panuon.UI.Silver.Internal.Utils;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using System.Windows.Media;
+
+namespace Panuon.UI.Silver
+{
+ [TemplatePart(Name = ThumbFenceTemplateName, Type = typeof(ThumbFence))]
+ [TemplatePart(Name = DropperThumbTemplateName, Type = typeof(Thumb))]
+ [TemplatePart(Name = AccentColorSliderTemplateName, Type = typeof(Slider))]
+ [TemplatePart(Name = OpacitySliderTemplateName, Type = typeof(Slider))]
+ [TemplatePart(Name = HEXTextBoxTemplateName, Type = typeof(TextBox))]
+ [TemplatePart(Name = ATextBoxTemplateName, Type = typeof(TextBox))]
+ [TemplatePart(Name = RTextBoxTemplateName, Type = typeof(TextBox))]
+ [TemplatePart(Name = GTextBoxTemplateName, Type = typeof(TextBox))]
+ [TemplatePart(Name = BTextBoxTemplateName, Type = typeof(TextBox))]
+ public class ColorSelector : Control
+ {
+ #region Fields
+ private const string ThumbFenceTemplateName = "PART_ThumbFence";
+
+ private const string DropperThumbTemplateName = "PART_DropperThumb";
+
+ private const string AccentColorSliderTemplateName = "PART_AccentColorSlider";
+
+ private const string OpacitySliderTemplateName = "PART_OpacitySlider";
+
+ private const string HEXTextBoxTemplateName = "PART_HEXTextBox";
+
+ private const string ATextBoxTemplateName = "PART_ATextBox";
+
+ private const string RTextBoxTemplateName = "PART_RTextBox";
+
+ private const string GTextBoxTemplateName = "PART_GTextBox";
+
+ private const string BTextBoxTemplateName = "PART_BTextBox";
+
+ internal ThumbFence _thumbFence;
+
+ private Thumb _dropperThumb;
+
+ private Slider _accentColorSlider;
+
+ private Slider _opacitySlider;
+
+ private TextBox _hexTextBox;
+
+ private TextBox _aTextBox;
+
+ private TextBox _rTextBox;
+
+ private TextBox _gTextBox;
+
+ private TextBox _bTextBox;
+
+ private static List _gradientColors;
+
+ private static GradientStop[] _gradientStops;
+
+ private bool _isInternalSetHEXTextBox;
+
+ private bool _isInternalSetARGBTextBox;
+
+ private bool _isInternalSetOpacitySlider;
+
+ private bool _isInternalUpdateSelector;
+ #endregion
+
+ #region Ctor
+ static ColorSelector()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(ColorSelector), new FrameworkPropertyMetadata(typeof(ColorSelector)));
+
+ _gradientStops = new GradientStop[]
+ {
+ new GradientStop(Color.FromRgb(255, 0, 0), 0),
+ new GradientStop(Color.FromRgb(255, 255, 0), 0.167),
+ new GradientStop(Color.FromRgb(0, 255, 0), 0.334),
+ new GradientStop(Color.FromRgb(0, 255, 255), 0.501),
+ new GradientStop(Color.FromRgb(0, 0, 255), 0.668),
+ new GradientStop(Color.FromRgb(255, 0, 255), 0.835),
+ new GradientStop(Color.FromRgb(255, 0, 0), 1),
+ };
+ _gradientColors = _gradientStops.OrderByDescending(x => x.Offset)
+ .Select(x => x.Color)
+ .ToList();
+ }
+ #endregion
+
+ #region Events
+
+ #region SelectedColorChanged
+ public event SelectedValueChangedEventHandler SelectedColorChanged
+ {
+ add { AddHandler(SelectedColorChangedEvent, value); }
+ remove { RemoveHandler(SelectedColorChangedEvent, value); }
+ }
+
+ public static readonly RoutedEvent SelectedColorChangedEvent =
+ EventManager.RegisterRoutedEvent("SelectedColorChanged", RoutingStrategy.Bubble, typeof(SelectedValueChangedEventHandler), typeof(ColorSelector));
+ #endregion
+
+ #endregion
+
+ #region Properties
+
+ #region CornerRadius
+ public CornerRadius CornerRadius
+ {
+ get { return (CornerRadius)GetValue(CornerRadiusProperty); }
+ set { SetValue(CornerRadiusProperty, value); }
+ }
+
+ public static readonly DependencyProperty CornerRadiusProperty =
+ DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(ColorSelector));
+ #endregion
+
+ #region ColorChannels
+ public ColorChannels ColorChannels
+ {
+ get { return (ColorChannels)GetValue(ColorChannelsProperty); }
+ set { SetValue(ColorChannelsProperty, value); }
+ }
+
+ public static readonly DependencyProperty ColorChannelsProperty =
+ DependencyProperty.Register("ColorChannels", typeof(ColorChannels), typeof(ColorSelector), new PropertyMetadata(ColorChannels.ARGB, OnColorChannelsChanged));
+
+ #endregion
+
+ #region AccentColor
+ internal Color AccentColor
+ {
+ get { return (Color)GetValue(AccentColorProperty); }
+ set { SetValue(AccentColorProperty, value); }
+ }
+
+ internal static readonly DependencyPropertyKey AccentColorPropertyKey =
+ DependencyProperty.RegisterReadOnly("AccentColor", typeof(Color), typeof(ColorSelector), new PropertyMetadata(Colors.Red));
+
+ public static readonly DependencyProperty AccentColorProperty =
+ AccentColorPropertyKey.DependencyProperty;
+ #endregion
+
+ #region SelectedColor
+ public Color SelectedColor
+ {
+ get { return (Color)GetValue(SelectedColorProperty); }
+ set { SetValue(SelectedColorProperty, value); }
+ }
+
+ public static readonly DependencyProperty SelectedColorProperty =
+ DependencyProperty.Register("SelectedColor", typeof(Color), typeof(ColorSelector), new FrameworkPropertyMetadata(Colors.White, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnSelectedColorChanged));
+ #endregion
+
+ #region SelectedOpaqueColor
+ internal Color SelectedOpaqueColor
+ {
+ get { return (Color)GetValue(SelectedOpaqueColorProperty); }
+ }
+
+ internal static readonly DependencyPropertyKey SelectedOpaqueColorPropertyKey =
+ DependencyProperty.RegisterReadOnly("SelectedOpaqueColor", typeof(Color), typeof(ColorSelector), new PropertyMetadata(Colors.White));
+
+ public static readonly DependencyProperty SelectedOpaqueColorProperty =
+ SelectedOpaqueColorPropertyKey.DependencyProperty;
+ #endregion
+
+ #region DropperThumbStyle
+ public Style DropperThumbStyle
+ {
+ get { return (Style)GetValue(DropperThumbStyleProperty); }
+ set { SetValue(DropperThumbStyleProperty, value); }
+ }
+
+ public static readonly DependencyProperty DropperThumbStyleProperty =
+ DependencyProperty.Register("DropperThumbStyle", typeof(Style), typeof(ColorSelector));
+ #endregion
+
+ #region ThumbFenceStyle
+ public Style ThumbFenceStyle
+ {
+ get { return (Style)GetValue(ThumbFenceStyleProperty); }
+ set { SetValue(ThumbFenceStyleProperty, value); }
+ }
+
+ public static readonly DependencyProperty ThumbFenceStyleProperty =
+ DependencyProperty.Register("ThumbFenceStyle", typeof(Style), typeof(ColorSelector));
+ #endregion
+
+ #region SliderStyle
+ public Style SliderStyle
+ {
+ get { return (Style)GetValue(SliderStyleProperty); }
+ set { SetValue(SliderStyleProperty, value); }
+ }
+
+ public static readonly DependencyProperty SliderStyleProperty =
+ DependencyProperty.Register("SliderStyle", typeof(Style), typeof(ColorSelector));
+ #endregion
+
+ #region TextBoxStyle
+ public Style InputTextBoxStyle
+ {
+ get { return (Style)GetValue(InputTextBoxStyleProperty); }
+ set { SetValue(InputTextBoxStyleProperty, value); }
+ }
+
+ public static readonly DependencyProperty InputTextBoxStyleProperty =
+ DependencyProperty.Register("InputTextBoxStyle", typeof(Style), typeof(ColorSelector));
+ #endregion
+
+ #endregion
+
+ #region Overrides
+
+ #region OnApplyTemplate
+ public override void OnApplyTemplate()
+ {
+ _thumbFence = GetTemplateChild(ThumbFenceTemplateName) as ThumbFence;
+ _thumbFence.ThumbPositionChanging += ThumbFence_ThumbPositionChanging;
+ _thumbFence.ThumbPositionChanged += ThumbFence_PositionChanged;
+
+ _dropperThumb = GetTemplateChild(DropperThumbTemplateName) as Thumb;
+ _dropperThumb.PreviewMouseDown += DropperThumb_PreviewMouseDown;
+ _dropperThumb.PreviewMouseUp += DropperThumb_PreviewMouseUp;
+ _dropperThumb.DragDelta += DropperThumb_DragDelta;
+ _dropperThumb.DragStarted += DropperThumb_DragStarted;
+ _dropperThumb.DragCompleted += _dropperThumb_DragCompleted;
+
+ _accentColorSlider = GetTemplateChild(AccentColorSliderTemplateName) as Slider;
+ _accentColorSlider.ValueChanged += AccentColorSlider_ValueChanged;
+
+ _opacitySlider = GetTemplateChild(OpacitySliderTemplateName) as Slider;
+ _opacitySlider.ValueChanged += OpacitySlider_ValueChanged;
+
+ _hexTextBox = GetTemplateChild(HEXTextBoxTemplateName) as TextBox;
+ _hexTextBox.TextChanged += TextBox_TextChanged;
+
+ _aTextBox = GetTemplateChild(ATextBoxTemplateName) as TextBox;
+ _aTextBox.TextChanged += TextBox_TextChanged;
+
+ _rTextBox = GetTemplateChild(RTextBoxTemplateName) as TextBox;
+ _rTextBox.TextChanged += TextBox_TextChanged;
+
+ _gTextBox = GetTemplateChild(GTextBoxTemplateName) as TextBox;
+ _gTextBox.TextChanged += TextBox_TextChanged;
+
+ _bTextBox = GetTemplateChild(BTextBoxTemplateName) as TextBox;
+ _bTextBox.TextChanged += TextBox_TextChanged;
+
+ UpdateSelectedOpaqueColor();
+ UpdateHEXTextBoxText();
+ UpdateARGBTextBoxText();
+ UpdateFenchPositionAndAccentColorSliderValue();
+ UpdateOpacitySlider();
+ UpdateAccentColor();
+ }
+
+ private void DropperThumb_DragStarted(object sender, DragStartedEventArgs e)
+ {
+ Cursor = CursorUtil.DropperCursor;
+ }
+
+ private void _dropperThumb_DragCompleted(object sender, DragCompletedEventArgs e)
+ {
+ Cursor = Cursors.Arrow;
+ }
+
+ private void DropperThumb_PreviewMouseDown(object sender, MouseButtonEventArgs e)
+ {
+ Cursor = CursorUtil.DropperCursor;
+ }
+
+ private void DropperThumb_PreviewMouseUp(object sender, MouseButtonEventArgs e)
+ {
+ Cursor = Cursors.Arrow;
+ }
+ #endregion
+
+ #endregion
+
+ #region Event Handlers
+ private static void OnSelectedColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var selector = (ColorSelector)d;
+ selector.UpdateSelectedOpaqueColor();
+ selector.UpdateHEXTextBoxText();
+ selector.UpdateARGBTextBoxText();
+ selector.UpdateFenchPositionAndAccentColorSliderValue();
+ selector.UpdateOpacitySlider();
+ selector.UpdateAccentColor();
+ selector.RaiseEvent(new SelectedValueChangedEventArgs(SelectedColorChangedEvent, (Color)e.OldValue, (Color)e.NewValue));
+ }
+
+ private static void OnColorChannelsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var selector = (ColorSelector)d;
+ selector.UpdateHEXTextBoxText();
+ }
+
+ private void ThumbFence_ThumbPositionChanging(object sender, PositionChangingEventArgs e)
+ {
+
+ }
+
+ private void ThumbFence_PositionChanged(object sender, Core.PositionChangedEventArgs e)
+ {
+ if (_isInternalUpdateSelector)
+ {
+ return;
+ }
+ _isInternalUpdateSelector = true;
+
+ UpdateSelectedColor();
+
+ _isInternalUpdateSelector = false;
+ }
+
+ private void OpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ {
+ if (_isInternalSetOpacitySlider)
+ {
+ return;
+ }
+ UpdateSelectedColorOpacity();
+ }
+
+ private void AccentColorSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ {
+ if (_isInternalUpdateSelector)
+ {
+ return;
+ }
+ _isInternalUpdateSelector = true;
+
+ UpdateAccentColor();
+ UpdateSelectedColor();
+
+ _isInternalUpdateSelector = false;
+ }
+
+ private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ var textBox = sender as TextBox;
+ var selectedColor = SelectedColor;
+
+ if (textBox.Tag is string tag && tag == "HEX")
+ {
+ if (!_isInternalSetHEXTextBox)
+ {
+ _isInternalSetHEXTextBox = true;
+
+ if (ColorUtil.FromHEXString(textBox.Text) is Color newColor)
+ {
+ if (ColorChannels == ColorChannels.RGB)
+ {
+ newColor.A = 255;
+ }
+ selectedColor = newColor;
+ }
+
+ SetCurrentValue(SelectedColorProperty, selectedColor);
+
+ _isInternalSetHEXTextBox = false;
+ }
+ }
+ else
+ {
+ if (!_isInternalSetARGBTextBox)
+ {
+ _isInternalSetARGBTextBox = true;
+
+ switch (textBox.Tag)
+ {
+ case "HEX":
+
+ break;
+ case "A":
+ if (!_isInternalSetOpacitySlider)
+ {
+ if (int.TryParse(textBox.Text, out int a))
+ {
+ var byteA = (byte)Math.Min(255, Math.Max(0, a));
+ selectedColor.A = byteA;
+ }
+ }
+ break;
+ case "R":
+ if (int.TryParse(textBox.Text, out int r))
+ {
+ var byteR = (byte)Math.Min(255, Math.Max(0, r));
+ selectedColor.R = byteR;
+ }
+ break;
+ case "G":
+ if (int.TryParse(textBox.Text, out int g))
+ {
+ var byteG = (byte)Math.Min(255, Math.Max(0, g));
+ selectedColor.G = byteG;
+ }
+ break;
+ case "B":
+ if (int.TryParse(textBox.Text, out int b))
+ {
+ var byteB = (byte)Math.Min(255, Math.Max(0, b));
+ selectedColor.B = byteB;
+ }
+ break;
+ }
+ SetCurrentValue(SelectedColorProperty, selectedColor);
+
+ _isInternalSetARGBTextBox = false;
+ }
+ }
+ }
+
+ private void DropperThumb_DragDelta(object sender, DragDeltaEventArgs e)
+ {
+ var point = PointToScreen(Mouse.GetPosition(this));
+ var color = ColorUtil.GetScreenColor(point.X, point.Y);
+ SetCurrentValue(SelectedColorProperty, color);
+ }
+ #endregion
+
+ #region Functions
+ private void UpdateSelectedColor()
+ {
+ if (_thumbFence == null)
+ {
+ return;
+ }
+
+ var position = _thumbFence.ThumbPosition;
+ var accentColor = AccentColor;
+
+ var colorLeft = Color.FromRgb((byte)(255 * (1 - position.Y))
+ , (byte)(255 * (1 - position.Y))
+ , (byte)(255 * (1 - position.Y)));
+
+ var colorRight = Color.FromRgb((byte)(accentColor.R * (1 - position.Y))
+ , (byte)(accentColor.G * (1 - position.Y))
+ , (byte)(accentColor.B * (1 - position.Y)));
+
+ var selectedColor = Color.FromRgb((byte)(colorLeft.R - (colorLeft.R - colorRight.R) * position.X)
+ , (byte)(colorLeft.G - (colorLeft.G - colorRight.G) * position.X)
+ , (byte)(colorLeft.B - (colorLeft.B - colorRight.B) * position.X));
+
+ var opacity = 1 - (_opacitySlider.Value / 100d);
+ selectedColor.A = (byte)(opacity * 255);
+
+ SetCurrentValue(SelectedColorProperty, selectedColor);
+
+ }
+
+ private void UpdateSelectedOpaqueColor()
+ {
+ if (!IsInitialized)
+ {
+ return;
+ }
+ var selectedOpaqueColor = new Color()
+ {
+ A = 255,
+ R = SelectedColor.R,
+ G = SelectedColor.G,
+ B = SelectedColor.B,
+ };
+ SetValue(SelectedOpaqueColorPropertyKey, selectedOpaqueColor);
+ }
+
+ private void UpdateHEXTextBoxText()
+ {
+ if (_hexTextBox == null
+ || _isInternalSetHEXTextBox)
+ {
+ return;
+ }
+ _isInternalSetHEXTextBox = true;
+
+ var selectedColor = SelectedColor;
+
+ _hexTextBox.Text = ColorUtil.ToHEXString(selectedColor, ColorChannels == ColorChannels.ARGB, false);
+
+ _isInternalSetHEXTextBox = false;
+ }
+
+ private void UpdateARGBTextBoxText()
+ {
+ if (_aTextBox == null
+ || _rTextBox == null
+ || _gTextBox == null
+ || _bTextBox == null
+ || _isInternalSetARGBTextBox)
+ {
+ return;
+ }
+
+ _isInternalSetARGBTextBox = true;
+
+ var selectedColor = SelectedColor;
+
+ _aTextBox.Text = selectedColor.A.ToString();
+ _rTextBox.Text = selectedColor.R.ToString();
+ _gTextBox.Text = selectedColor.G.ToString();
+ _bTextBox.Text = selectedColor.B.ToString();
+
+ _isInternalSetARGBTextBox = false;
+ }
+
+ private void UpdateSelectedColorOpacity()
+ {
+ if (_opacitySlider == null)
+ {
+ return;
+ }
+
+ var opacity = 1 - (_opacitySlider.Value / 100d);
+ var color = SelectedColor;
+ color.A = (byte)(opacity * 255);
+ SetCurrentValue(SelectedColorProperty, color);
+ }
+
+ private void UpdateAccentColor()
+ {
+ if (_accentColorSlider == null)
+ {
+ return;
+ }
+
+ Color accentColor = default;
+
+ var offset = 1 - (_accentColorSlider.Value / 100d);
+ if (offset == 0)
+ {
+ accentColor = _gradientStops.First().Color;
+ }
+ else if (offset == 1)
+ {
+ accentColor = _gradientStops.Last().Color;
+ }
+ else
+ {
+ var left = _gradientStops.Last(s => s.Offset <= offset);
+ var right = _gradientStops.First(s => s.Offset > offset);
+ offset = Math.Round((offset - left.Offset) / (right.Offset - left.Offset), 2);
+ accentColor = (Color.FromRgb((byte)((right.Color.R - left.Color.R) * offset + left.Color.R)
+ , (byte)((right.Color.G - left.Color.G) * offset + left.Color.G)
+ , (byte)((right.Color.B - left.Color.B) * offset + left.Color.B)));
+ }
+
+ SetValue(AccentColorPropertyKey, accentColor);
+ }
+
+ private void UpdateFenchPositionAndAccentColorSliderValue()
+ {
+ if (_isInternalUpdateSelector
+ || _thumbFence == null
+ || _accentColorSlider == null)
+ {
+ return;
+ }
+
+ _isInternalUpdateSelector = true;
+
+ var rgbList = new List
+ {
+ SelectedColor.R,
+ SelectedColor.G,
+ SelectedColor.B
+ };
+ var minValue = rgbList.Min();
+ var maxValue = rgbList.Max();
+ var minIndex = rgbList.IndexOf(minValue);
+ var maxIndex = rgbList.IndexOf(maxValue);
+
+ double sliderValue = 0d;
+ if (minIndex == 0 && maxIndex == 0)
+ {
+ sliderValue = 0;
+ }
+ else
+ {
+ var middleIndex = 3 - minIndex - maxIndex;
+ var middleValue = rgbList[middleIndex];
+ var middleNewValue = (byte)(255 * (minValue - middleValue) / (double)(minValue - maxValue));
+
+ rgbList[maxIndex] = 255;
+ rgbList[minIndex] = 0;
+ rgbList[middleIndex] = 0;
+
+ var colorIndex = _gradientColors.IndexOf(Color.FromRgb(rgbList[0], rgbList[1], rgbList[2]));
+
+ if (colorIndex < 5 && colorIndex > 0)
+ {
+ var nextColor = _gradientColors[colorIndex + 1];
+ var prevColor = _gradientColors[colorIndex - 1];
+
+ var nextBytes = new List() { nextColor.R, nextColor.G, nextColor.B };
+ var prevBytes = new List() { prevColor.R, prevColor.G, prevColor.B };
+
+ if (nextBytes[minIndex] > 0)
+ {
+ sliderValue = (prevBytes[middleIndex] - middleNewValue) / 255.0 + colorIndex - 1;
+ }
+ else
+ {
+ sliderValue = middleNewValue / 255.0 + colorIndex;
+ }
+ }
+ else if (colorIndex == 0)
+ {
+ if (minIndex == 2)
+ {
+ sliderValue = colorIndex + (255 - middleNewValue) / 255.0 + 5;
+ }
+ else
+ {
+ sliderValue = middleNewValue / 255.0;
+ }
+ }
+ else
+ {
+ sliderValue = (255 - middleNewValue) / 255.0;
+ }
+ }
+ _accentColorSlider.Value = sliderValue * 100 / 6d;
+
+ var pointX = maxValue == 0
+ ? 0
+ : (1 - minValue / (double)maxValue);
+ var pointY = 1 - maxValue / 255d;
+ _thumbFence.ThumbPosition = new Point(pointX, pointY);
+
+ _isInternalUpdateSelector = false;
+ }
+
+ private void UpdateOpacitySlider()
+ {
+ if (_opacitySlider == null
+ || _isInternalSetOpacitySlider)
+ {
+ return;
+ }
+ _isInternalSetOpacitySlider = true;
+
+ var selectorColor = SelectedColor;
+ _opacitySlider.Value = 100 - (int)(selectorColor.A * 100 / 255d);
+
+ _isInternalSetOpacitySlider = false;
+ }
+ #endregion
+ }
+}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Drawer.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Drawer.cs
index a0793ac5..f98fe889 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Drawer.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Drawer.cs
@@ -23,7 +23,7 @@ static Drawer()
}
#endregion
- #region Events
+ #region Routed Events
#region Opened
public event RoutedEventHandler Opened
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Switch.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Switch.cs
index 42d243e6..0debbec6 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Switch.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Switch.cs
@@ -231,13 +231,13 @@ public Color? CheckedToggleShadowColor
#region Internal Properties
#region InternalToggleShadowColor
- public Color? InternalToggleShadowColor
+ internal Color? InternalToggleShadowColor
{
get { return (Color?)GetValue(InternalToggleShadowColorProperty); }
set { SetValue(InternalToggleShadowColorProperty, value); }
}
- public static readonly DependencyProperty InternalToggleShadowColorProperty =
+ internal static readonly DependencyProperty InternalToggleShadowColorProperty =
DependencyProperty.Register("InternalToggleShadowColor", typeof(Color?), typeof(Switch));
#endregion
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/ThumbFence.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/ThumbFence.cs
new file mode 100644
index 00000000..75f121a3
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/ThumbFence.cs
@@ -0,0 +1,241 @@
+using Panuon.UI.Core;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using System.Windows.Threading;
+
+namespace Panuon.UI.Silver
+{
+ [TemplatePart(Name = CanvasTemplateName, Type = typeof(Canvas))]
+ [TemplatePart(Name = ThumbTemplateName, Type = typeof(Thumb))]
+ public class ThumbFence : Control
+ {
+ #region Fields
+ private const string CanvasTemplateName = "PART_Canvas";
+
+ private const string ThumbTemplateName = "PART_Thumb";
+
+ private Canvas _canvas;
+
+ internal Thumb _thumb;
+ #endregion
+
+ #region Ctor
+ static ThumbFence()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(ThumbFence), new FrameworkPropertyMetadata(typeof(ThumbFence)));
+ }
+ #endregion
+
+ #region Routed Events
+
+ #region PositionChanged
+ public event PositionChangedEventHandler ThumbPositionChanged
+ {
+ add { AddHandler(ThumbPositionChangedEvent, value); }
+ remove { RemoveHandler(ThumbPositionChangedEvent, value); }
+ }
+
+ public static readonly RoutedEvent ThumbPositionChangedEvent =
+ EventManager.RegisterRoutedEvent("ThumbPositionChanged", RoutingStrategy.Bubble, typeof(PositionChangedEventHandler), typeof(ThumbFence));
+ #endregion
+
+ #region PositionChanging
+ public event PositionChangingEventHandler ThumbPositionChanging
+ {
+ add { AddHandler(ThumbPositionChangingEvent, value); }
+ remove { RemoveHandler(ThumbPositionChangingEvent, value); }
+ }
+
+ public static readonly RoutedEvent ThumbPositionChangingEvent =
+ EventManager.RegisterRoutedEvent("ThumbPositionChanging", RoutingStrategy.Bubble, typeof(PositionChangingEventHandler), typeof(ThumbFence));
+ #endregion
+
+ #endregion
+
+ #region Properties
+
+ #region ThumbPosition
+ public Point ThumbPosition
+ {
+ get { return (Point)GetValue(ThumbPositionProperty); }
+ set { SetValue(ThumbPositionProperty, value); }
+ }
+
+ public static readonly DependencyProperty ThumbPositionProperty =
+ DependencyProperty.Register("ThumbPosition", typeof(Point), typeof(ThumbFence), new PropertyMetadata(new Point(), OnPositionChanged, OnPositionCoerceValue));
+
+ #endregion
+
+ #region CornerRadius
+ public CornerRadius CornerRadius
+ {
+ get { return (CornerRadius)GetValue(CornerRadiusProperty); }
+ set { SetValue(CornerRadiusProperty, value); }
+ }
+
+ public static readonly DependencyProperty CornerRadiusProperty =
+ DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(ThumbFence));
+ #endregion
+
+ #region ThumbStyle
+ public Style ThumbStyle
+ {
+ get { return (Style)GetValue(ThumbStyleProperty); }
+ set { SetValue(ThumbStyleProperty, value); }
+ }
+
+ public static readonly DependencyProperty ThumbStyleProperty =
+ DependencyProperty.Register("ThumbStyle", typeof(Style), typeof(ThumbFence), new PropertyMetadata(OnEffectivePropertyChanged));
+ #endregion
+
+ #region AllowCross
+ public bool AllowCross
+ {
+ get { return (bool)GetValue(AllowCrossProperty); }
+ set { SetValue(AllowCrossProperty, value); }
+ }
+
+ public static readonly DependencyProperty AllowCrossProperty =
+ DependencyProperty.Register("AllowCross", typeof(bool), typeof(ThumbFence), new PropertyMetadata(OnEffectivePropertyChanged));
+ #endregion
+
+ #endregion
+
+ #region Overrides
+
+ #region OnApplyTemplate
+ public override void OnApplyTemplate()
+ {
+ _canvas = GetTemplateChild(CanvasTemplateName) as Canvas;
+
+ _thumb = GetTemplateChild(ThumbTemplateName) as Thumb;
+ _thumb.DragDelta += Thumb_DragDelta;
+ }
+ #endregion
+
+ #region OnPreviewMouseLeftButtonDown
+ protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
+ {
+ var renderWidth = _canvas.RenderSize.Width;
+ var renderHeight = _canvas.RenderSize.Height;
+ if (renderWidth == 0 || renderHeight == 0)
+ {
+ return;
+ }
+ var mousePosition = e.GetPosition(_canvas);
+ var position = new Point(mousePosition.X / renderWidth, mousePosition.Y / renderHeight);
+
+ var args = new PositionChangingEventArgs(ThumbPositionChangingEvent, position);
+ RaiseEvent(args);
+ if (!args.Cancel)
+ {
+ SetCurrentValue(ThumbPositionProperty, args.NewPosition);
+ }
+
+ _thumb.RaiseEvent(e);
+
+ e.Handled = true;
+ base.OnMouseLeftButtonDown(e);
+ }
+
+ protected override void OnMouseUp(MouseButtonEventArgs e)
+ {
+ base.OnMouseUp(e);
+ }
+
+ protected override void OnPreviewMouseUp(MouseButtonEventArgs e)
+ {
+ base.OnPreviewMouseUp(e);
+ }
+ #endregion
+
+ #region OnRenderSizeChanged
+ protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
+ {
+ base.OnRenderSizeChanged(sizeInfo);
+ Relocation();
+ }
+ #endregion
+
+ #endregion
+
+ #region Event Handlers
+ private static object OnPositionCoerceValue(DependencyObject d, object baseValue)
+ {
+ var position = (Point)baseValue;
+ position.X = Math.Max(0, Math.Min(1, position.X));
+ position.Y = Math.Max(0, Math.Min(1, position.Y));
+ return position;
+ }
+
+ private static void OnPositionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var fence = (ThumbFence)d;
+ fence.Relocation();
+ fence.RaiseEvent(new PositionChangedEventArgs(ThumbPositionChangedEvent, (Point)e.NewValue));
+ }
+
+ private static void OnEffectivePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var fence = (ThumbFence)d;
+ fence.Relocation();
+ }
+
+ private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
+ {
+ var renderWidth = _canvas.RenderSize.Width;
+ var renderHeight = _canvas.RenderSize.Height;
+ if (renderWidth == 0 || renderHeight == 0)
+ {
+ return;
+ }
+ var mousePosition = Mouse.GetPosition(this);
+ var position = new Point(mousePosition.X / renderWidth, mousePosition.Y / renderHeight);
+
+ var args = new PositionChangingEventArgs(ThumbPositionChangingEvent, position);
+ RaiseEvent(args);
+ if (!args.Cancel)
+ {
+ SetCurrentValue(ThumbPositionProperty, args.NewPosition);
+ }
+
+ }
+ #endregion
+
+ #region Functions
+ private void Relocation()
+ {
+ if (_thumb == null || _canvas == null
+ || _canvas.RenderSize.Width == 0 || _canvas.RenderSize.Height == 0)
+ {
+ return;
+ }
+
+ var thumbWidth = _thumb.RenderSize.Width;
+ var thumbHeight = _thumb.RenderSize.Width;
+ var halfThumbWidth = thumbWidth / 2;
+ var halfThumbHeight = thumbHeight / 2;
+ var renderWidth = _canvas.RenderSize.Width;
+ var renderHeight = _canvas.RenderSize.Height;
+
+ var left = AllowCross
+ ? ThumbPosition.X * renderWidth - halfThumbWidth
+ : ThumbPosition.X * (renderWidth - thumbWidth) + halfThumbWidth;
+ var top = AllowCross
+ ? ThumbPosition.Y * renderHeight - halfThumbHeight
+ : ThumbPosition.Y * (renderHeight - thumbHeight) + halfThumbHeight;
+ Canvas.SetLeft(_thumb, left);
+ Canvas.SetTop(_thumb, top);
+
+ }
+
+ #endregion
+
+ }
+}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/WIndowX.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/WIndowX.cs
index 4388d699..cda077c8 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/WIndowX.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/WIndowX.cs
@@ -17,10 +17,30 @@
namespace Panuon.UI.Silver
{
[TemplatePart(Name = ContentPresenterTemplateName, Type = typeof(ContentPresenter))]
+ [TemplatePart(Name = CancelButtonTemplateName, Type = typeof(Button))]
+ [TemplatePart(Name = NoButtonTemplateName, Type = typeof(Button))]
+ [TemplatePart(Name = YesButtonTemplateName, Type = typeof(Button))]
+ [TemplatePart(Name = OKButtonTemplateName, Type = typeof(Button))]
public class WindowX : Window, INotifyPropertyChanged
{
#region Fields
- protected const string ContentPresenterTemplateName = "PART_ContentPresenter";
+ private const string ContentPresenterTemplateName = "PART_ContentPresenter";
+
+ private const string CancelButtonTemplateName = "PART_CancelButton";
+
+ private const string NoButtonTemplateName = "PART_NoButton";
+
+ private const string YesButtonTemplateName = "PART_YesButton";
+
+ private const string OKButtonTemplateName = "PART_OKButton";
+
+ private Button _okButton;
+
+ private Button _cancelButton;
+
+ private Button _noButton;
+
+ private Button _yesButton;
private WindowState _lastWindowState;
@@ -48,6 +68,24 @@ public WindowX()
#region Overrides
+ #region OnApplyTemplate
+ public override void OnApplyTemplate()
+ {
+ _cancelButton = GetTemplateChild(CancelButtonTemplateName) as Button;
+ _cancelButton.Click += ModalButton_Click;
+
+ _okButton = GetTemplateChild(OKButtonTemplateName) as Button;
+ _okButton.Click += ModalButton_Click;
+
+ _yesButton = GetTemplateChild(YesButtonTemplateName) as Button;
+ _yesButton.Click += ModalButton_Click;
+
+ _noButton = GetTemplateChild(NoButtonTemplateName) as Button;
+ _noButton.Click += ModalButton_Click;
+ }
+
+ #endregion
+
#region OnPreviewKeyUp
protected override void OnPreviewKeyUp(KeyEventArgs e)
{
@@ -78,6 +116,8 @@ protected override void OnClosed(EventArgs e)
owner.IsMaskVisible = false;
}
base.OnClosed(e);
+
+ IsClosed = true;
}
#endregion
@@ -214,6 +254,22 @@ public bool InteropOwnersMask
DependencyProperty.Register("Effect", typeof(WindowXEffect), typeof(WindowX), new PropertyMetadata(null, OnWindowXEffectChanged));
#endregion
+ #region IsClosed
+ public bool IsClosed { get; private set; }
+ #endregion
+
+ #endregion
+
+ #region Internal Properties
+
+ internal Button ModalOKButton => _okButton;
+
+ internal Button ModalYesButton => _yesButton;
+
+ internal Button ModalNoButton => _noButton;
+
+ internal Button ModalCancelButton => _cancelButton;
+
#endregion
#region Attached Properties
@@ -396,7 +452,6 @@ private static object OnCaptionBackgroundCoerceValue(DependencyObject d, object
return baseValue;
}
-
private static object OnGlassFrameThicknessCoerceValue(DependencyObject d, object baseValue)
{
var windowX = (WindowX)d;
@@ -407,7 +462,6 @@ private static object OnGlassFrameThicknessCoerceValue(DependencyObject d, objec
return baseValue;
}
-
private void WindowX_Loaded(object sender, RoutedEventArgs e)
{
if (!_isLoaded)
@@ -511,6 +565,25 @@ private static void OnWindowChromeChanged(DependencyObject d, DependencyProperty
var windowX = (WindowX)d;
WindowChromeUtil.SetCaptionHeight(windowX, windowX.DisableDragMove ? 0 : WindowXCaption.GetHeight(windowX));
}
+
+
+ private void ModalButton_Click(object sender, RoutedEventArgs e)
+ {
+ var button = sender as Button;
+ switch (button.Tag)
+ {
+ case "Cancel":
+ Close();
+ break;
+ case "Yes":
+ case "OK":
+ DialogResult = true;
+ break;
+ case "No":
+ DialogResult = false;
+ break;
+ }
+ }
#endregion
#region Functions
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Enums/ColorChannels.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Enums/ColorChannels.cs
new file mode 100644
index 00000000..367089bb
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Enums/ColorChannels.cs
@@ -0,0 +1,8 @@
+namespace Panuon.UI.Silver
+{
+ public enum ColorChannels
+ {
+ ARGB,
+ RGB,
+ }
+}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Enums/ColorTextFormats.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Enums/ColorTextFormats.cs
new file mode 100644
index 00000000..572df50d
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Enums/ColorTextFormats.cs
@@ -0,0 +1,8 @@
+namespace Panuon.UI.Silver
+{
+ public enum ColorTextFormats
+ {
+ HEX,
+ ARGB,
+ }
+}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ButtonHelper.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ButtonHelper.cs
index 4aef1dfa..f26ca2e3 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ButtonHelper.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ButtonHelper.cs
@@ -159,6 +159,20 @@ public static void SetHoverBorderBrush(Button button, Brush value)
VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(ButtonHelper));
#endregion
+ #region HoverShadowColor
+ public static Color? GetHoverShadowColor(Button button)
+ {
+ return (Color?)button.GetValue(HoverShadowColorProperty);
+ }
+
+ public static void SetHoverShadowColor(Button button, Color? value)
+ {
+ button.SetValue(HoverShadowColorProperty, value);
+ }
+ public static readonly DependencyProperty HoverShadowColorProperty =
+ VisualStateHelper.HoverShadowColorProperty.AddOwner(typeof(ButtonHelper));
+ #endregion
+
#region ClickBackground
public static Brush GetClickBackground(Button button)
{
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ComboBoxHelper.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ComboBoxHelper.cs
index 475dab07..322cc38e 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ComboBoxHelper.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ComboBoxHelper.cs
@@ -198,6 +198,20 @@ public static void SetHoverBorderBrush(ComboBox comboBox, Brush value)
VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(ComboBoxHelper));
#endregion
+ #region HoverShadowColor
+ public static Color? GetHoverShadowColor(ComboBox comboBox)
+ {
+ return (Color?)comboBox.GetValue(HoverShadowColorProperty);
+ }
+
+ public static void SetHoverShadowColor(ComboBox comboBox, Color? value)
+ {
+ comboBox.SetValue(HoverShadowColorProperty, value);
+ }
+ public static readonly DependencyProperty HoverShadowColorProperty =
+ VisualStateHelper.HoverShadowColorProperty.AddOwner(typeof(ComboBoxHelper));
+ #endregion
+
#region FocusedBackground
public static Brush GetFocusedBackground(ComboBox comboBox)
{
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ListBoxItemHelper.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ListBoxItemHelper.cs
index 6ad580fa..4c5d95cd 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ListBoxItemHelper.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ListBoxItemHelper.cs
@@ -245,7 +245,7 @@ public static void SetIsStyleless(ListBoxItem listBoxItem, bool value)
public static readonly DependencyProperty IsStylelessProperty =
DependencyProperty.RegisterAttached("IsStyleless", typeof(bool), typeof(ListBoxItemHelper));
-
+
#endregion
}
}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/MessageBoxX.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/MessageBoxX.cs
index 61ddb547..cd46a2bc 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/MessageBoxX.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/MessageBoxX.cs
@@ -258,8 +258,18 @@ public static MessageBoxResult Show(Window owner, string message, string caption
private static MessageBoxResult CallMessageBoxXWindow(Window owner, string message, string caption, MessageBoxButton button, MessageBoxIcon icon, DefaultButton defaultButton, MessageBoxXSetting setting)
{
var window = new MessageBoxXWindow(message, caption, button, icon, defaultButton, owner, setting ?? MessageBoxXSettings.Setting);
- window.ShowDialog();
- return window.Result;
+ var dialogResult = window.ShowDialog();
+ switch (dialogResult)
+ {
+ case true:
+ return (button == MessageBoxButton.YesNo || button == MessageBoxButton.YesNoCancel)
+ ? MessageBoxResult.Yes
+ : MessageBoxResult.OK;
+ case false:
+ return MessageBoxResult.No;
+ default:
+ return MessageBoxResult.Cancel;
+ }
}
#endregion
}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/PasswordBoxHelper.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/PasswordBoxHelper.cs
index 27882129..58efd3a6 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/PasswordBoxHelper.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/PasswordBoxHelper.cs
@@ -160,6 +160,20 @@ public static void SetHoverBorderBrush(PasswordBox passwordBox, Brush value)
VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(PasswordBoxHelper));
#endregion
+ #region HoverShadowColor
+ public static Color? GetHoverShadowColor(PasswordBox passwordBox)
+ {
+ return (Color?)passwordBox.GetValue(HoverShadowColorProperty);
+ }
+
+ public static void SetHoverShadowColor(PasswordBox passwordBox, Color? value)
+ {
+ passwordBox.SetValue(HoverShadowColorProperty, value);
+ }
+ public static readonly DependencyProperty HoverShadowColorProperty =
+ VisualStateHelper.HoverShadowColorProperty.AddOwner(typeof(PasswordBoxHelper));
+ #endregion
+
#region FocusedShadowColor
public static Color? GetFocusedShadowColor(PasswordBox passwordBox)
{
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/PendingBoxSettings.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/PendingBoxSettings.cs
index 34145985..86482bf1 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/PendingBoxSettings.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/PendingBoxSettings.cs
@@ -1,4 +1,5 @@
using Panuon.UI.Silver.Configurations;
+using Panuon.UI.Silver.Internal.Utils;
using System.Windows;
namespace Panuon.UI.Silver
@@ -6,7 +7,10 @@ namespace Panuon.UI.Silver
public class PendingBoxSettings
{
#region Static Properties
- public static PendingBoxSetting Setting { get; } = new PendingBoxSetting();
+ public static PendingBoxSetting Setting { get; } = new PendingBoxSetting()
+ {
+ CancelButtonContent = LocalizationUtil.Cancel,
+ };
#endregion
#region Properties
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/RepeatButtonHelper.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/RepeatButtonHelper.cs
index 590f1865..407dc93b 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/RepeatButtonHelper.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/RepeatButtonHelper.cs
@@ -159,6 +159,20 @@ public static void SetHoverBorderBrush(RepeatButton repeatButton, Brush value)
VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(RepeatButtonHelper));
#endregion
+ #region HoverShadowColor
+ public static Color? GetHoverShadowColor(RepeatButton repeatButton)
+ {
+ return (Color?)repeatButton.GetValue(HoverShadowColorProperty);
+ }
+
+ public static void SetHoverShadowColor(RepeatButton repeatButton, Color? value)
+ {
+ repeatButton.SetValue(HoverShadowColorProperty, value);
+ }
+ public static readonly DependencyProperty HoverShadowColorProperty =
+ VisualStateHelper.HoverShadowColorProperty.AddOwner(typeof(RepeatButtonHelper));
+ #endregion
+
#region ClickBackground
public static Brush GetClickBackground(RepeatButton repeatButton)
{
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/SliderHelper.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/SliderHelper.cs
index ada20331..6bd18eec 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/SliderHelper.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/SliderHelper.cs
@@ -70,139 +70,19 @@ public static void SetCoveredBackground(Slider slider, Brush value)
DependencyProperty.RegisterAttached("CoveredBackground", typeof(Brush), typeof(SliderHelper));
#endregion
- #region ThumbWidth
- public static double GetThumbWidth(Slider slider)
+ #region ThumbStyle
+ public static Style GetThumbStyle(Slider slider)
{
- return (double)slider.GetValue(ThumbWidthProperty);
+ return (Style)slider.GetValue(ThumbStyleProperty);
}
- public static void SetThumbWidth(Slider slider, double value)
+ public static void SetThumbStyle(Slider slider, Style value)
{
- slider.SetValue(ThumbWidthProperty, value);
+ slider.SetValue(ThumbStyleProperty, value);
}
- public static readonly DependencyProperty ThumbWidthProperty =
- DependencyProperty.RegisterAttached("ThumbWidth", typeof(double), typeof(SliderHelper), new PropertyMetadata(20d));
- #endregion
-
- #region ThumbHeight
- public static double GetThumbHeight(Slider slider)
- {
- return (double)slider.GetValue(ThumbHeightProperty);
- }
-
- public static void SetThumbHeight(Slider slider, double value)
- {
- slider.SetValue(ThumbHeightProperty, value);
- }
-
- public static readonly DependencyProperty ThumbHeightProperty =
- DependencyProperty.RegisterAttached("ThumbHeight", typeof(double), typeof(SliderHelper), new PropertyMetadata(20d));
- #endregion
-
- #region ThumbBackground
- public static Brush GetThumbBackground(Slider slider)
- {
- return (Brush)slider.GetValue(ThumbBackgroundProperty);
- }
-
- public static void SetThumbBackground(Slider slider, Brush value)
- {
- slider.SetValue(ThumbBackgroundProperty, value);
- }
-
- public static readonly DependencyProperty ThumbBackgroundProperty =
- DependencyProperty.RegisterAttached("ThumbBackground", typeof(Brush), typeof(SliderHelper));
- #endregion
-
- #region ThumbBorderBrush
- public static Brush GetThumbBorderBrush(DependencyObject obj)
- {
- return (Brush)obj.GetValue(ThumbBorderBrushProperty);
- }
-
- public static void SetThumbBorderBrush(DependencyObject obj, Brush value)
- {
- obj.SetValue(ThumbBorderBrushProperty, value);
- }
-
- public static readonly DependencyProperty ThumbBorderBrushProperty =
- DependencyProperty.RegisterAttached("ThumbBorderBrush", typeof(Brush), typeof(SliderHelper));
- #endregion
-
- #region ThumbBorderThickness
- public static double GetThumbBorderThickness(DependencyObject obj)
- {
- return (double)obj.GetValue(ThumbBorderThicknessProperty);
- }
-
- public static void SetThumbBorderThickness(DependencyObject obj, double value)
- {
- obj.SetValue(ThumbBorderThicknessProperty, value);
- }
-
- public static readonly DependencyProperty ThumbBorderThicknessProperty =
- DependencyProperty.RegisterAttached("ThumbBorderThickness", typeof(double), typeof(SliderHelper));
- #endregion
-
- #region ThumbHoverBackground
- public static Brush GetThumbHoverBackground(Slider slider)
- {
- return (Brush)slider.GetValue(ThumbHoverBackgroundProperty);
- }
-
- public static void SetThumbHoverBackground(Slider slider, Brush value)
- {
- slider.SetValue(ThumbHoverBackgroundProperty, value);
- }
-
- public static readonly DependencyProperty ThumbHoverBackgroundProperty =
- VisualStateHelper.HoverBackgroundProperty.AddOwner(typeof(SliderHelper));
- #endregion
-
- #region ThumbCornerRadius
- public static CornerRadius GetThumbCornerRadius(Slider slider)
- {
- return (CornerRadius)slider.GetValue(ThumbCornerRadiusProperty);
- }
-
- public static void SetThumbCornerRadius(Slider slider, CornerRadius value)
- {
- slider.SetValue(ThumbCornerRadiusProperty, value);
- }
-
- public static readonly DependencyProperty ThumbCornerRadiusProperty =
- DependencyProperty.RegisterAttached("ThumbCornerRadius", typeof(CornerRadius), typeof(SliderHelper));
- #endregion
-
- #region ThumbTemplate
- public static DataTemplate GetThumbTemplate(Slider slider)
- {
- return (DataTemplate)slider.GetValue(ThumbTemplateProperty);
- }
-
- public static void SetThumbTemplate(Slider slider, DataTemplate value)
- {
- slider.SetValue(ThumbTemplateProperty, value);
- }
-
- public static readonly DependencyProperty ThumbTemplateProperty =
- DependencyProperty.RegisterAttached("ThumbTemplate", typeof(DataTemplate), typeof(SliderHelper));
- #endregion
-
- #region ThumbShadowColor
- public static Color? GetThumbShadowColor(Slider slider)
- {
- return (Color?)slider.GetValue(ThumbShadowColorProperty);
- }
-
- public static void SetThumbShadowColor(Slider slider, Color? value)
- {
- slider.SetValue(ThumbShadowColorProperty, value);
- }
-
- public static readonly DependencyProperty ThumbShadowColorProperty =
- DependencyProperty.RegisterAttached("ThumbShadowColor", typeof(Color?), typeof(SliderHelper));
+ public static readonly DependencyProperty ThumbStyleProperty =
+ DependencyProperty.RegisterAttached("ThumbStyle", typeof(Style), typeof(SliderHelper));
#endregion
#endregion
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/TextBoxHelper.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/TextBoxHelper.cs
index c434ea15..373bed2c 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/TextBoxHelper.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/TextBoxHelper.cs
@@ -130,6 +130,20 @@ public static void SetHoverBorderBrush(TextBox textBox, Brush value)
VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(TextBoxHelper));
#endregion
+ #region HoverShadowColor
+ public static Color? GetHoverShadowColor(TextBox textBox)
+ {
+ return (Color?)textBox.GetValue(HoverShadowColorProperty);
+ }
+
+ public static void SetHoverShadowColor(TextBox textBox, Color? value)
+ {
+ textBox.SetValue(HoverShadowColorProperty, value);
+ }
+ public static readonly DependencyProperty HoverShadowColorProperty =
+ VisualStateHelper.HoverShadowColorProperty.AddOwner(typeof(TextBoxHelper));
+ #endregion
+
#region FocusedShadowColor
public static Color? GetFocusedShadowColor(TextBox textBox)
{
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ThumbHelper.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ThumbHelper.cs
new file mode 100644
index 00000000..e3178cb7
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ThumbHelper.cs
@@ -0,0 +1,149 @@
+using Panuon.UI.Silver.Internal;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Media;
+
+namespace Panuon.UI.Silver
+{
+ public static class ThumbHelper
+ {
+ #region Properties
+
+ #region Content
+ public static object GetContent(Thumb thunb)
+ {
+ return (object)thunb.GetValue(ContentProperty);
+ }
+
+ public static void SetContent(Thumb thunb, object value)
+ {
+ thunb.SetValue(ContentProperty, value);
+ }
+
+ public static readonly DependencyProperty ContentProperty =
+ DependencyProperty.RegisterAttached("Content", typeof(object), typeof(ThumbHelper));
+ #endregion
+
+ #region ContentTemplate
+ public static DataTemplate GetContentTemplate(Thumb thunb)
+ {
+ return (DataTemplate)thunb.GetValue(ContentTemplateProperty);
+ }
+
+ public static void SetContentTemplate(Thumb thunb, DataTemplate value)
+ {
+ thunb.SetValue(ContentTemplateProperty, value);
+ }
+
+ public static readonly DependencyProperty ContentTemplateProperty =
+ DependencyProperty.RegisterAttached("ContentTemplate", typeof(DataTemplate), typeof(ThumbHelper));
+ #endregion
+
+ #region ContentTemplateSelector
+ public static DataTemplateSelector GetContentTemplateSelector(Thumb thunb)
+ {
+ return (DataTemplateSelector)thunb.GetValue(ContentTemplateSelectorProperty);
+ }
+
+ public static void SetContentTemplateSelector(Thumb thunb, DataTemplateSelector value)
+ {
+ thunb.SetValue(ContentTemplateSelectorProperty, value);
+ }
+
+ public static readonly DependencyProperty ContentTemplateSelectorProperty =
+ DependencyProperty.RegisterAttached("ContentTemplateSelector", typeof(DataTemplateSelector), typeof(ThumbHelper));
+ #endregion
+
+ #region CornerRadius
+ public static CornerRadius GetCornerRadius(Thumb thumb)
+ {
+ return (CornerRadius)thumb.GetValue(CornerRadiusProperty);
+ }
+
+ public static void SetCornerRadius(Thumb thumb, CornerRadius value)
+ {
+ thumb.SetValue(CornerRadiusProperty, value);
+ }
+
+ public static readonly DependencyProperty CornerRadiusProperty =
+ DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(ThumbHelper));
+ #endregion
+
+ #region ShadowColor
+ public static Color? GetShadowColor(Thumb thumb)
+ {
+ return (Color?)thumb.GetValue(ShadowColorProperty);
+ }
+
+ public static void SetShadowColor(Thumb thumb, Color? value)
+ {
+ thumb.SetValue(ShadowColorProperty, value);
+ }
+
+ public static readonly DependencyProperty ShadowColorProperty =
+ VisualStateHelper.ShadowColorProperty.AddOwner(typeof(ThumbHelper));
+ #endregion
+
+ #region HoverBackground
+ public static Brush GetHoverBackground(Thumb thumb)
+ {
+ return (Brush)thumb.GetValue(HoverBackgroundProperty);
+ }
+
+ public static void SetHoverBackground(Thumb thumb, Brush value)
+ {
+ thumb.SetValue(HoverBackgroundProperty, value);
+ }
+
+ public static readonly DependencyProperty HoverBackgroundProperty =
+ VisualStateHelper.HoverBackgroundProperty.AddOwner(typeof(ThumbHelper));
+ #endregion
+
+ #region HoverForeground
+ public static Brush GetHoverForeground(Thumb thumb)
+ {
+ return (Brush)thumb.GetValue(HoverForegroundProperty);
+ }
+
+ public static void SetHoverForeground(Thumb thumb, Brush value)
+ {
+ thumb.SetValue(HoverForegroundProperty, value);
+ }
+
+ public static readonly DependencyProperty HoverForegroundProperty =
+ VisualStateHelper.HoverForegroundProperty.AddOwner(typeof(ThumbHelper));
+ #endregion
+
+ #region HoverBorderBrush
+ public static Brush GetHoverBorderBrush(Thumb thumb)
+ {
+ return (Brush)thumb.GetValue(HoverBorderBrushProperty);
+ }
+
+ public static void SetHoverBorderBrush(Thumb thumb, Brush value)
+ {
+ thumb.SetValue(HoverBorderBrushProperty, value);
+ }
+
+ public static readonly DependencyProperty HoverBorderBrushProperty =
+ VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(ThumbHelper));
+ #endregion
+
+ #region HoverShadowColor
+ public static Color? GetHoverShadowColor(Thumb thumb)
+ {
+ return (Color?)thumb.GetValue(HoverShadowColorProperty);
+ }
+
+ public static void SetHoverShadowColor(Thumb thumb, Color? value)
+ {
+ thumb.SetValue(HoverShadowColorProperty, value);
+ }
+ public static readonly DependencyProperty HoverShadowColorProperty =
+ VisualStateHelper.HoverShadowColorProperty.AddOwner(typeof(ThumbHelper));
+ #endregion
+
+ #endregion
+ }
+}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ToggleButtonHelper.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ToggleButtonHelper.cs
index 058d27ea..1f94f9e2 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ToggleButtonHelper.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ToggleButtonHelper.cs
@@ -144,6 +144,20 @@ public static void SetHoverBorderBrush(ToggleButton toggleButton, Brush value)
VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(ToggleButtonHelper));
#endregion
+ #region HoverShadowColor
+ public static Color? GetHoverShadowColor(ToggleButton toggleButton)
+ {
+ return (Color?)toggleButton.GetValue(HoverShadowColorProperty);
+ }
+
+ public static void SetHoverShadowColor(ToggleButton toggleButton, Color? value)
+ {
+ toggleButton.SetValue(HoverShadowColorProperty, value);
+ }
+ public static readonly DependencyProperty HoverShadowColorProperty =
+ VisualStateHelper.HoverShadowColorProperty.AddOwner(typeof(ToggleButtonHelper));
+ #endregion
+
#region CheckedBackground
public static Brush GetCheckedBackground(ToggleButton toggleButton)
{
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/WindowXModalDialog.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/WindowXModalDialog.cs
new file mode 100644
index 00000000..546d18ee
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/WindowXModalDialog.cs
@@ -0,0 +1,186 @@
+using Panuon.UI.Silver.Internal.Utils;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Panuon.UI.Silver
+{
+ public static class WindowXModalDialog
+ {
+ #region Properties
+
+ #region Buttons
+ public static MessageBoxButton? GetButtons(WindowX windowX)
+ {
+ return (MessageBoxButton?)windowX.GetValue(ButtonsProperty);
+ }
+
+ public static void SetButtons(WindowX windowX, MessageBoxButton? value)
+ {
+ windowX.SetValue(ButtonsProperty, value);
+ }
+
+ public static readonly DependencyProperty ButtonsProperty =
+ DependencyProperty.RegisterAttached("Buttons", typeof(MessageBoxButton?), typeof(WindowXModalDialog));
+ #endregion
+
+ #region ButtonStyle
+ public static Style GetButtonStyle(WindowX windowX)
+ {
+ return (Style)windowX.GetValue(ButtonStyleProperty);
+ }
+
+ public static void SetButtonStyle(WindowX windowX, Style value)
+ {
+ windowX.SetValue(ButtonStyleProperty, value);
+ }
+
+ public static readonly DependencyProperty ButtonStyleProperty =
+ DependencyProperty.RegisterAttached("ButtonStyle", typeof(Style), typeof(WindowXModalDialog));
+ #endregion
+
+ #region DefaultButton
+ public static DefaultButton GetDefaultButton(WindowX windowX)
+ {
+ return (DefaultButton)windowX.GetValue(DefaultButtonProperty);
+ }
+
+ public static void SetDefaultButton(WindowX windowX, DefaultButton value)
+ {
+ windowX.SetValue(DefaultButtonProperty, value);
+ }
+
+ public static readonly DependencyProperty DefaultButtonProperty =
+ DependencyProperty.RegisterAttached("DefaultButton", typeof(DefaultButton), typeof(WindowXModalDialog));
+ #endregion
+
+ #region InverseButtonsSequence
+ public static bool GetInverseButtonsSequence(WindowX windowX)
+ {
+ return (bool)windowX.GetValue(InverseButtonsSequenceProperty);
+ }
+
+ public static void SetInverseButtonsSequence(WindowX windowX, bool value)
+ {
+ windowX.SetValue(InverseButtonsSequenceProperty, value);
+ }
+
+ public static readonly DependencyProperty InverseButtonsSequenceProperty =
+ DependencyProperty.RegisterAttached("InverseButtonsSequence", typeof(bool), typeof(WindowXModalDialog));
+ #endregion
+
+ #region ButtonPanelMargin
+ public static Thickness GetButtonPanelMargin(WindowX windowX)
+ {
+ return (Thickness)windowX.GetValue(ButtonPanelMarginProperty);
+ }
+
+ public static void SetButtonPanelMargin(WindowX windowX, Thickness value)
+ {
+ windowX.SetValue(ButtonPanelMarginProperty, value);
+ }
+
+ public static readonly DependencyProperty ButtonPanelMarginProperty =
+ DependencyProperty.RegisterAttached("ButtonPanelMargin", typeof(Thickness), typeof(WindowXModalDialog));
+ #endregion
+
+ #region ButtonPanelHorizontalAlignment
+ public static HorizontalAlignment GetButtonPanelHorizontalAlignment(WindowX windowX)
+ {
+ return (HorizontalAlignment)windowX.GetValue(ButtonPanelHorizontalAlignmentProperty);
+ }
+
+ public static void SetButtonPanelHorizontalAlignment(WindowX windowX, HorizontalAlignment value)
+ {
+ windowX.SetValue(ButtonPanelHorizontalAlignmentProperty, value);
+ }
+
+ public static readonly DependencyProperty ButtonPanelHorizontalAlignmentProperty =
+ DependencyProperty.RegisterAttached("ButtonPanelHorizontalAlignment", typeof(HorizontalAlignment), typeof(WindowXModalDialog));
+ #endregion
+
+ #region OKButtonContent
+ public static object GetOKButtonContent(WindowX windowX)
+ {
+ return (object)windowX.GetValue(OKButtonContentProperty);
+ }
+
+ public static void SetOKButtonContent(WindowX windowX, object value)
+ {
+ windowX.SetValue(OKButtonContentProperty, value);
+ }
+
+ public static readonly DependencyProperty OKButtonContentProperty =
+ DependencyProperty.RegisterAttached("OKButtonContent", typeof(object), typeof(WindowXModalDialog), new PropertyMetadata(LocalizationUtil.OK));
+ #endregion
+
+ #region YesButtonContent
+ public static object GetYesButtonContent(WindowX windowX)
+ {
+ return (object)windowX.GetValue(YesButtonContentProperty);
+ }
+
+ public static void SetYesButtonContent(WindowX windowX, object value)
+ {
+ windowX.SetValue(YesButtonContentProperty, value);
+ }
+
+ public static readonly DependencyProperty YesButtonContentProperty =
+ DependencyProperty.RegisterAttached("YesButtonContent", typeof(object), typeof(WindowXModalDialog), new PropertyMetadata(LocalizationUtil.Yes));
+ #endregion
+
+ #region NoButtonContent
+ public static object GetNoButtonContent(WindowX windowX)
+ {
+ return (object)windowX.GetValue(NoButtonContentProperty);
+ }
+
+ public static void SetNoButtonContent(WindowX windowX, object value)
+ {
+ windowX.SetValue(NoButtonContentProperty, value);
+ }
+
+ public static readonly DependencyProperty NoButtonContentProperty =
+ DependencyProperty.RegisterAttached("NoButtonContent", typeof(object), typeof(WindowXModalDialog), new PropertyMetadata(LocalizationUtil.No));
+ #endregion
+
+ #region CancelButtonContent
+ public static object GetCancelButtonContent(WindowX windowX)
+ {
+ return (object)windowX.GetValue(CancelButtonContentProperty);
+ }
+
+ public static void SetCancelButtonContent(WindowX windowX, object value)
+ {
+ windowX.SetValue(CancelButtonContentProperty, value);
+ }
+
+ public static readonly DependencyProperty CancelButtonContentProperty =
+ DependencyProperty.RegisterAttached("CancelButtonContent", typeof(object), typeof(WindowXModalDialog), new PropertyMetadata(LocalizationUtil.Cancel));
+ #endregion
+
+ #endregion
+
+ #region Methods
+ public static Button GetOKButton(WindowX windowX)
+ {
+ return windowX.ModalOKButton;
+ }
+
+ public static Button GetCancelButton(WindowX windowX)
+ {
+ return windowX.ModalCancelButton;
+ }
+
+ public static Button GetYesButton(WindowX windowX)
+ {
+ return windowX.ModalYesButton;
+ }
+
+ public static Button GetNoButton(WindowX windowX)
+ {
+ return windowX.ModalNoButton;
+ }
+ #endregion
+
+ }
+}
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Panuon.UI.Silver.projitems b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Panuon.UI.Silver.projitems
index bd68f970..eeadf910 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Panuon.UI.Silver.projitems
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Panuon.UI.Silver.projitems
@@ -31,6 +31,8 @@
+
+
@@ -41,9 +43,12 @@
+
+
+
@@ -73,6 +78,7 @@
+
@@ -116,6 +122,7 @@
+
@@ -130,6 +137,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Properties/AssemblyInfo.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Properties/AssemblyInfo.cs
index 3cc4b619..434ca78e 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Properties/AssemblyInfo.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Properties/AssemblyInfo.cs
@@ -49,5 +49,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.2.14")]
-[assembly: AssemblyFileVersion("2.2.14")]
+[assembly: AssemblyVersion("2.2.15")]
+[assembly: AssemblyFileVersion("2.2.15")]
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Resources/ConverterKeys.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Resources/ConverterKeys.cs
index c948b9b3..ac20a8ac 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Resources/ConverterKeys.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Resources/ConverterKeys.cs
@@ -2,6 +2,8 @@
{
public static class ConverterKeys
{
+ public const string BrushToColorConverter = nameof(BrushToColorConverter);
+ public const string ColorToBrushConverter = nameof(ColorToBrushConverter);
public const string DoubleDivideByConverter = nameof(DoubleDivideByConverter);
public const string DoubleEqualsConverter = nameof(DoubleEqualsConverter);
public const string DoubleMinusConverter = nameof(DoubleMinusConverter);
@@ -20,6 +22,7 @@ public static class ConverterKeys
public const string IsStringNullOrEmptyConverter = nameof(IsStringNullOrEmptyConverter);
public const string NonnullToCollapseConverter = nameof(NonnullToCollapseConverter);
public const string NullToCollapseConverter = nameof(NullToCollapseConverter);
+ public const string OppositeColorConverter = nameof(OppositeColorConverter);
public const string StringNonnullAndNotEmptyToCollapseConverter = nameof(StringNonnullAndNotEmptyToCollapseConverter);
public const string StringNullOrEmptyToCollapseConverter = nameof(StringNullOrEmptyToCollapseConverter);
public const string TrueToCollapseConverter = nameof(TrueToCollapseConverter);
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Resources/StyleKeys.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Resources/StyleKeys.cs
index 26f4d781..791ba9c2 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Resources/StyleKeys.cs
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Resources/StyleKeys.cs
@@ -32,6 +32,7 @@ public static class StyleKeys
public const string TabControlStyle = nameof(TabControlStyle);
public const string TabItemStyle = nameof(TabItemStyle);
public const string TextBoxStyle = nameof(TextBoxStyle);
+ public const string ThumbStyle = nameof(ThumbStyle);
public const string ToolTipStyle = nameof(ToolTipStyle);
public const string TreeViewStyle = nameof(TreeViewStyle);
public const string TreeViewItemStyle = nameof(TreeViewItemStyle);
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Styles/Thumb.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Styles/Thumb.xaml
new file mode 100644
index 00000000..2f0ca48b
--- /dev/null
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Styles/Thumb.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Themes/Generic.Core.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Themes/Generic.Core.xaml
index 937a3753..08a8253a 100644
--- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Themes/Generic.Core.xaml
+++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Themes/Generic.Core.xaml
@@ -9,6 +9,8 @@
+
+
@@ -25,6 +27,7 @@
+