diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorCanvas/Implementation/ColorCanvas.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorCanvas/Implementation/ColorCanvas.cs
index 2b922d02..dbc7d1ff 100644
--- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorCanvas/Implementation/ColorCanvas.cs
+++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorCanvas/Implementation/ColorCanvas.cs
@@ -5,6 +5,7 @@ using System.Windows.Input;
using System.Windows.Media;
using Microsoft.Windows.Controls.Primitives;
using Microsoft.Windows.Controls.Core.Utilities;
+using System.Windows.Data;
namespace Microsoft.Windows.Controls
{
@@ -237,19 +238,29 @@ namespace Microsoft.Windows.Controls
#endregion //RGB
#region HexadecimalString
-
- public static readonly DependencyProperty HexadecimalStringProperty = DependencyProperty.Register("HexadecimalString", typeof(string), typeof(ColorCanvas), new PropertyMetadata("#FFFFFFFF", new PropertyChangedCallback(OnHexadecimalStringPropertyChanged)));
+
+ public static readonly DependencyProperty HexadecimalStringProperty = DependencyProperty.Register("HexadecimalString", typeof(string), typeof(ColorCanvas), new UIPropertyMetadata("#FFFFFFFF", OnHexadecimalStringChanged));
public string HexadecimalString
{
get { return (string)GetValue(HexadecimalStringProperty); }
set { SetValue(HexadecimalStringProperty, value); }
}
- private static void OnHexadecimalStringPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ private static void OnHexadecimalStringChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
{
-
+ ColorCanvas colorCanvas = o as ColorCanvas;
+ if (colorCanvas != null)
+ colorCanvas.OnHexadecimalStringChanged((string)e.OldValue, (string)e.NewValue);
}
+ protected virtual void OnHexadecimalStringChanged(string oldValue, string newValue)
+ {
+ if (!SelectedColor.ToString().Equals(newValue))
+ {
+ SetSelectedColorAndPositionSelector((Color)ColorConverter.ConvertFromString(newValue));
+ }
+ }
+
#endregion //HexadecimalString
#endregion //Properties
@@ -283,6 +294,16 @@ namespace Microsoft.Windows.Controls
SetSelectedColorAndPositionSelector(SelectedColor);
}
+ protected override void OnPreviewKeyDown(KeyEventArgs e)
+ {
+ //hitting enter on textbox will update value of underlying source
+ if (e.Key == Key.Enter && e.OriginalSource is TextBox)
+ {
+ BindingExpression be = ((TextBox)e.OriginalSource).GetBindingExpression(TextBox.TextProperty);
+ be.UpdateSource();
+ }
+ }
+
#endregion //Base Class Overrides
#region Event Handlers
diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorCanvas/Themes/Generic.xaml b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorCanvas/Themes/Generic.xaml
index b7f71e71..858b0b52 100644
--- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorCanvas/Themes/Generic.xaml
+++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorCanvas/Themes/Generic.xaml
@@ -12,7 +12,7 @@
-
+
@@ -41,13 +41,152 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-