diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorPicker/ColorPicker.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorPicker/ColorPicker.cs index bf79f654..03b31965 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorPicker/ColorPicker.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorPicker/ColorPicker.cs @@ -20,6 +20,7 @@ namespace Microsoft.Windows.Controls private ColorSpectrumSlider _spectrumSlider; private Point? _currentColorPosition; private Color _currentColor = Colors.White; + private bool _isLoaded; #endregion //Private Members @@ -257,6 +258,8 @@ namespace Microsoft.Windows.Controls _okButton = (Button)GetTemplateChild("PART_OkButton"); _okButton.Click += OkButton_Click; + + SetSelectedColor(SelectedColor); } #endregion //Base Class Overrides @@ -332,7 +335,7 @@ namespace Microsoft.Windows.Controls SetValue(RProperty, _currentColor.R); SetValue(GProperty, _currentColor.G); SetValue(BProperty, _currentColor.B); - UpdateColorShadeSelectorPosition(theColor); + UpdateColorShadeSelectorPosition(_currentColor); } private void UpdateColorShadeSelectorPositionAndCalculateColor(Point p, bool calculateColor = true) @@ -363,6 +366,9 @@ namespace Microsoft.Windows.Controls private void UpdateColorShadeSelectorPosition(Color color) { + if (_spectrumSlider == null || _colorShadingCanvas == null) + return; + _currentColorPosition = null; HsvColor hsv = ColorUtilities.ConvertRgbToHsv(color.R, color.G, color.B); diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Themes/Generic.xaml b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Themes/Generic.xaml index aef5a00c..029683ed 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Themes/Generic.xaml @@ -189,7 +189,7 @@ - +