diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/BusyIndicator/BusyIndicator.xaml b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/BusyIndicator/BusyIndicator.xaml
deleted file mode 100644
index a43fa9e1..00000000
--- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/BusyIndicator/BusyIndicator.xaml
+++ /dev/null
@@ -1,142 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Collapsed
-
-
-
-
-
-
- Collapsed
-
-
-
-
-
-
-
-
-
-
- Visible
-
-
-
-
-
-
- Visible
-
-
-
-
-
-
-
-
-
-
-
-
- True
-
-
-
-
-
-
-
-
-
-
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/ChildWindow.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/ChildWindow.cs
index a92cf075..8a44695d 100644
--- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/ChildWindow.cs
+++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/ChildWindow.cs
@@ -8,6 +8,8 @@ using System.ComponentModel;
namespace Microsoft.Windows.Controls
{
+ [TemplateVisualState(GroupName = VisualStates.WindowStatesGroup, Name = VisualStates.Open)]
+ [TemplateVisualState(GroupName = VisualStates.WindowStatesGroup, Name = VisualStates.Closed)]
public class ChildWindow : ContentControl
{
#region Private Members
@@ -31,7 +33,15 @@ namespace Microsoft.Windows.Controls
public ChildWindow()
{
-
+ LayoutUpdated += (o, e) =>
+ {
+ //we only want to set the start position if this is the first time the control has bee initialized
+ if (!_startupPositionInitialized)
+ {
+ SetStartupPosition();
+ _startupPositionInitialized = true;
+ }
+ };
}
#endregion //Constructors
@@ -58,27 +68,16 @@ namespace Microsoft.Windows.Controls
WindowRoot = GetTemplateChild("PART_WindowRoot") as Grid;
WindowRoot.RenderTransform = _moveTransform;
- }
- protected override Size ArrangeOverride(Size arrangeBounds)
- {
+ //TODO: move somewhere else
_parent = VisualTreeHelper.GetParent(this) as FrameworkElement;
- _parent.LayoutUpdated += (o, e) =>
+ _parent.SizeChanged += (o, ea) =>
{
- //we only want to set the start position if this is the first time the control has bee initialized
- if (!_startupPositionInitialized)
- {
- _startupPositionInitialized = true;
- SetStartupPosition();
- }
- };
- _parent.SizeChanged += (o, e) =>
- {
- Overlay.Height = e.NewSize.Height;
- Overlay.Width = e.NewSize.Width;
+ Overlay.Height = ea.NewSize.Height;
+ Overlay.Width = ea.NewSize.Width;
};
- return base.ArrangeOverride(arrangeBounds);
+ ChangeVisualState();
}
#endregion //Base Class Overrides
@@ -221,7 +220,7 @@ namespace Microsoft.Windows.Controls
#region WindowState
- public static readonly DependencyProperty WindowStateProperty = DependencyProperty.Register("WindowState", typeof(WindowState), typeof(ChildWindow), new PropertyMetadata(WindowState.Closed, new PropertyChangedCallback(OnWindowStatePropertyChanged)));
+ public static readonly DependencyProperty WindowStateProperty = DependencyProperty.Register("WindowState", typeof(WindowState), typeof(ChildWindow), new PropertyMetadata(WindowState.Open, new PropertyChangedCallback(OnWindowStatePropertyChanged)));
public WindowState WindowState
{
get { return (WindowState)GetValue(WindowStateProperty); }
@@ -359,6 +358,8 @@ namespace Microsoft.Windows.Controls
break;
}
}
+
+ ChangeVisualState();
}
private void ExecuteClose()
@@ -368,8 +369,6 @@ namespace Microsoft.Windows.Controls
if (!e.Cancel)
{
- Visibility = System.Windows.Visibility.Hidden;
-
if (!_dialogResult.HasValue)
_dialogResult = false;
@@ -384,21 +383,9 @@ namespace Microsoft.Windows.Controls
private void ExecuteOpen()
{
_dialogResult = null; //reset the dialogResult to null each time the window is opened
-
- Visibility = System.Windows.Visibility.Visible;
-
- if (_parent != null)
- {
- int parentIndex = (int)_parent.GetValue(Canvas.ZIndexProperty);
- this.SetValue(Canvas.ZIndexProperty, ++parentIndex);
- }
- else
- {
- this.SetValue(Canvas.ZIndexProperty, 1);
- }
+ SetZIndex();
}
-
private void SetZIndex()
{
if (_parent != null)
@@ -428,6 +415,18 @@ namespace Microsoft.Windows.Controls
}
}
+ protected virtual void ChangeVisualState()
+ {
+ if (WindowState == WindowState.Closed)
+ {
+ VisualStateManager.GoToState(this, VisualStates.Closed, true);
+ }
+ else
+ {
+ VisualStateManager.GoToState(this, VisualStates.Open, true);
+ }
+ }
+
#endregion //Private
#region Protected
diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/ChildWindow.xaml b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/ChildWindow.xaml
deleted file mode 100644
index 45bcc828..00000000
--- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/ChildWindow.xaml
+++ /dev/null
@@ -1,196 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/VisualStates.ChildWindow.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/VisualStates.ChildWindow.cs
new file mode 100644
index 00000000..eb3a4ea9
--- /dev/null
+++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ChildWindow/VisualStates.ChildWindow.cs
@@ -0,0 +1,22 @@
+using System;
+
+namespace Microsoft.Windows.Controls
+{
+ internal static partial class VisualStates
+ {
+ ///
+ /// Window State group name.
+ ///
+ public const string WindowStatesGroup = "WindowStatesGroup";
+
+ ///
+ /// Open state name for ChildWindow.
+ ///
+ public const string Open = "Open";
+
+ ///
+ /// Closed state name for ChildWindow.
+ ///
+ public const string Closed = "Closed";
+ }
+}
diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorPicker/ColorPicker.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorPicker/ColorPicker.cs
index 19e55bcb..bf79f654 100644
--- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorPicker/ColorPicker.cs
+++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorPicker/ColorPicker.cs
@@ -68,9 +68,9 @@ namespace Microsoft.Windows.Controls
#region ScA
public static readonly DependencyProperty ScAProperty = DependencyProperty.Register("ScA", typeof(float), typeof(ColorPicker), new PropertyMetadata((float)1, new PropertyChangedCallback(OnScAPropertyChangedChanged)));
- public double ScA
+ public float ScA
{
- get { return (double)GetValue(ScAProperty); }
+ get { return (float)GetValue(ScAProperty); }
set { SetValue(ScAProperty, value); }
}
@@ -92,14 +92,14 @@ namespace Microsoft.Windows.Controls
#region ScR
- public static readonly DependencyProperty ScRProperty = DependencyProperty.Register("ScR", typeof(float), typeof(ColorPicker), new PropertyMetadata((float)1, new PropertyChangedCallback(ScRChanged)));
- public double ScR
+ public static readonly DependencyProperty ScRProperty = DependencyProperty.Register("ScR", typeof(float), typeof(ColorPicker), new PropertyMetadata((float)1, new PropertyChangedCallback(OnScRPropertyChanged)));
+ public float ScR
{
- get { return (double)GetValue(ScRProperty); }
+ get { return (float)GetValue(ScRProperty); }
set { SetValue(RProperty, value); }
}
- private static void ScRChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ private static void OnScRPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
@@ -108,14 +108,14 @@ namespace Microsoft.Windows.Controls
#region ScG
- public static readonly DependencyProperty ScGProperty = DependencyProperty.Register("ScG", typeof(float), typeof(ColorPicker), new PropertyMetadata((float)1, new PropertyChangedCallback(ScGChanged)));
- public double ScG
+ public static readonly DependencyProperty ScGProperty = DependencyProperty.Register("ScG", typeof(float), typeof(ColorPicker), new PropertyMetadata((float)1, new PropertyChangedCallback(OnScGPropertyChanged)));
+ public float ScG
{
- get { return (double)GetValue(ScGProperty); }
+ get { return (float)GetValue(ScGProperty); }
set { SetValue(GProperty, value); }
}
- private static void ScGChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ private static void OnScGPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
@@ -125,9 +125,9 @@ namespace Microsoft.Windows.Controls
#region ScB
public static readonly DependencyProperty ScBProperty = DependencyProperty.Register("ScB", typeof(float), typeof(ColorPicker), new PropertyMetadata((float)1, new PropertyChangedCallback(OnScBPropertyChanged)));
- public double ScB
+ public float ScB
{
- get { return (double)GetValue(BProperty); }
+ get { return (float)GetValue(BProperty); }
set { SetValue(BProperty, value); }
}
@@ -357,7 +357,8 @@ namespace Microsoft.Windows.Controls
_currentColorPosition = p;
- CalculateColor(p);
+ if (calculateColor)
+ CalculateColor(p);
}
private void UpdateColorShadeSelectorPosition(Color color)
@@ -371,17 +372,17 @@ namespace Microsoft.Windows.Controls
_currentColorPosition = p;
- _colorShadeSelectorTransform.X = p.X * _colorShadingCanvas.Width;
- _colorShadeSelectorTransform.Y = p.Y * _colorShadingCanvas.Height;
+ _colorShadeSelectorTransform.X = (p.X * _colorShadingCanvas.Width) - 5;
+ _colorShadeSelectorTransform.Y = (p.Y * _colorShadingCanvas.Height) - 5;
}
private void CalculateColor(Point p)
{
HsvColor hsv = new HsvColor(360 - _spectrumSlider.Value, 1, 1) { S = p.X, V = 1 - p.Y };
_currentColor = ColorUtilities.ConvertHsvToRgb(hsv.H, hsv.S, hsv.V); ;
- _currentColor.ScA = (float)GetValue(ScAProperty);
+ _currentColor.ScA = ScA;
CurrentColor = _currentColor;
- SetValue(HexadecimalStringProperty, _currentColor.ToString());
+ HexadecimalString = _currentColor.ToString();
}
#endregion //Methods
diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorPicker/ColorPicker.xaml b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorPicker/ColorPicker.xaml
deleted file mode 100644
index 7b07bb77..00000000
--- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/ColorPicker/ColorPicker.xaml
+++ /dev/null
@@ -1,367 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MessageBox/MessageBox.xaml b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MessageBox/MessageBox.xaml
deleted file mode 100644
index 7223ba9c..00000000
--- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MessageBox/MessageBox.xaml
+++ /dev/null
@@ -1,286 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/RichTextBox/RichTextBox.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/RichTextBox/RichTextBox.cs
index edd50f95..6fdbea1a 100644
--- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/RichTextBox/RichTextBox.cs
+++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/RichTextBox/RichTextBox.cs
@@ -115,11 +115,11 @@ namespace Microsoft.Windows.Controls
if (binding.UpdateSourceTrigger == UpdateSourceTrigger.Default || binding.UpdateSourceTrigger == UpdateSourceTrigger.LostFocus)
{
- LostFocus += (o, ea) => InvokeUpdateText();
+ LostFocus += (o, ea) => UpdateText(); //do this synchronously
}
else
{
- TextChanged += (o, ea) => InvokeUpdateText();
+ TextChanged += (o, ea) => InvokeUpdateText(); //do this async
}
}
diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Themes/Generic.xaml b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Themes/Generic.xaml
index 2250ce15..aef5a00c 100644
--- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Themes/Generic.xaml
+++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Themes/Generic.xaml
@@ -3,9 +3,99 @@
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:Microsoft.Windows.Controls">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -236,10 +241,10 @@
-