diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AssemblyVersionInfo.cs
index 74011485..45843ae6 100644
--- a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AssemblyVersionInfo.cs
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AssemblyVersionInfo.cs
@@ -22,7 +22,7 @@
internal static class _XceedVersionInfo
{
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
- public const string BaseVersion = "1.7";
+ public const string BaseVersion = "1.8";
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )]
public const string Version = BaseVersion +
_XceedVersionInfoCommon.Build;
diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AutoSelectTextBox/Implementation/AutoSelectBehaviorEnum.cs b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AutoSelectTextBox/Implementation/AutoSelectBehaviorEnum.cs
new file mode 100644
index 00000000..2340995d
--- /dev/null
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AutoSelectTextBox/Implementation/AutoSelectBehaviorEnum.cs
@@ -0,0 +1,31 @@
+/************************************************************************
+
+ Extended WPF Toolkit
+
+ Copyright (C) 2010-2012 Xceed Software Inc.
+
+ This program is provided to you under the terms of the Microsoft Public
+ License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
+
+ This program can be provided to you by Xceed Software Inc. under a
+ proprietary commercial license agreement for use in non-Open Source
+ projects. The commercial version of Extended WPF Toolkit also includes
+ priority technical support, commercial updates, and many additional
+ useful WPF controls if you license Xceed Business Suite for WPF.
+
+ Visit http://xceed.com and follow @datagrid on Twitter.
+
+ **********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Xceed.Wpf.Toolkit
+{
+ public enum AutoSelectBehavior
+ {
+ Never,
+ OnFocus
+ }
+}
diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AutoSelectTextBox/Implementation/AutoSelectTextBox.cs b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AutoSelectTextBox/Implementation/AutoSelectTextBox.cs
new file mode 100644
index 00000000..87aa6d0b
--- /dev/null
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AutoSelectTextBox/Implementation/AutoSelectTextBox.cs
@@ -0,0 +1,301 @@
+/************************************************************************
+
+ Extended WPF Toolkit
+
+ Copyright (C) 2010-2012 Xceed Software Inc.
+
+ This program is provided to you under the terms of the Microsoft Public
+ License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
+
+ This program can be provided to you by Xceed Software Inc. under a
+ proprietary commercial license agreement for use in non-Open Source
+ projects. The commercial version of Extended WPF Toolkit also includes
+ priority technical support, commercial updates, and many additional
+ useful WPF controls if you license Xceed Business Suite for WPF.
+
+ Visit http://xceed.com and follow @datagrid on Twitter.
+
+ **********************************************************************/
+
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows;
+using System.Windows.Automation;
+using Xceed.Wpf.Toolkit.Core.Utilities;
+
+namespace Xceed.Wpf.Toolkit
+{
+ public class AutoSelectTextBox : TextBox
+ {
+ static AutoSelectTextBox()
+ {
+ AutomationProperties.AutomationIdProperty.OverrideMetadata( typeof( AutoSelectTextBox ), new UIPropertyMetadata( "AutoSelectTextBox" ) );
+ }
+
+ #region AutoSelectBehavior PROPERTY
+
+ public AutoSelectBehavior AutoSelectBehavior
+ {
+ get
+ {
+ return ( AutoSelectBehavior )GetValue( AutoSelectBehaviorProperty );
+ }
+ set
+ {
+ SetValue( AutoSelectBehaviorProperty, value );
+ }
+ }
+
+ public static readonly DependencyProperty AutoSelectBehaviorProperty =
+ DependencyProperty.Register( "AutoSelectBehavior", typeof( AutoSelectBehavior ), typeof( AutoSelectTextBox ),
+ new UIPropertyMetadata( AutoSelectBehavior.Never ) );
+
+ #endregion AutoSelectBehavior PROPERTY
+
+ #region AutoMoveFocus PROPERTY
+
+ public bool AutoMoveFocus
+ {
+ get
+ {
+ return ( bool )GetValue( AutoMoveFocusProperty );
+ }
+ set
+ {
+ SetValue( AutoMoveFocusProperty, value );
+ }
+ }
+
+ public static readonly DependencyProperty AutoMoveFocusProperty =
+ DependencyProperty.Register( "AutoMoveFocus", typeof( bool ), typeof( AutoSelectTextBox ), new UIPropertyMetadata( false ) );
+
+ #endregion AutoMoveFocus PROPERTY
+
+ #region QueryMoveFocus EVENT
+
+ public static readonly RoutedEvent QueryMoveFocusEvent = EventManager.RegisterRoutedEvent( "QueryMoveFocus",
+ RoutingStrategy.Bubble,
+ typeof( QueryMoveFocusEventHandler ),
+ typeof( AutoSelectTextBox ) );
+ #endregion QueryMoveFocus EVENT
+
+ protected override void OnPreviewKeyDown( KeyEventArgs e )
+ {
+ if( !this.AutoMoveFocus )
+ {
+ base.OnPreviewKeyDown( e );
+ return;
+ }
+
+ if( ( e.Key == Key.Left )
+ && ( ( Keyboard.Modifiers == ModifierKeys.None )
+ || ( Keyboard.Modifiers == ModifierKeys.Control ) ) )
+ {
+ e.Handled = this.MoveFocusLeft();
+ }
+
+ if( ( e.Key == Key.Right )
+ && ( ( Keyboard.Modifiers == ModifierKeys.None )
+ || ( Keyboard.Modifiers == ModifierKeys.Control ) ) )
+ {
+ e.Handled = this.MoveFocusRight();
+ }
+
+ if( ( ( e.Key == Key.Up ) || ( e.Key == Key.PageUp ) )
+ && ( ( Keyboard.Modifiers == ModifierKeys.None )
+ || ( Keyboard.Modifiers == ModifierKeys.Control ) ) )
+ {
+ e.Handled = this.MoveFocusUp();
+ }
+
+ if( ( ( e.Key == Key.Down ) || ( e.Key == Key.PageDown ) )
+ && ( ( Keyboard.Modifiers == ModifierKeys.None )
+ || ( Keyboard.Modifiers == ModifierKeys.Control ) ) )
+ {
+ e.Handled = this.MoveFocusDown();
+ }
+
+ base.OnPreviewKeyDown( e );
+ }
+
+ protected override void OnPreviewGotKeyboardFocus( KeyboardFocusChangedEventArgs e )
+ {
+ base.OnPreviewGotKeyboardFocus( e );
+
+ if( this.AutoSelectBehavior == AutoSelectBehavior.OnFocus )
+ {
+ // If the focus was not in one of our child ( or popup ), we select all the text.
+ if( !TreeHelper.IsDescendantOf( e.OldFocus as DependencyObject, this ) )
+ this.SelectAll();
+ }
+ }
+
+ protected override void OnPreviewMouseLeftButtonDown( MouseButtonEventArgs e )
+ {
+ base.OnPreviewMouseLeftButtonDown( e );
+
+ if( this.AutoSelectBehavior == AutoSelectBehavior.Never )
+ return;
+
+ if( this.IsKeyboardFocusWithin == false )
+ {
+ this.Focus();
+ e.Handled = true;
+ }
+ }
+
+ protected override void OnTextChanged( TextChangedEventArgs e )
+ {
+ base.OnTextChanged( e );
+
+ if( !this.AutoMoveFocus )
+ return;
+
+ if( ( this.Text.Length != 0 )
+ && ( this.Text.Length == this.MaxLength )
+ && ( this.CaretIndex == this.MaxLength ) )
+ {
+ if( this.CanMoveFocus( FocusNavigationDirection.Right, true ) == true )
+ {
+ FocusNavigationDirection direction = ( this.FlowDirection == FlowDirection.LeftToRight )
+ ? FocusNavigationDirection.Right
+ : FocusNavigationDirection.Left;
+
+ this.MoveFocus( new TraversalRequest( direction ) );
+ }
+ }
+ }
+
+ private bool CanMoveFocus( FocusNavigationDirection direction, bool reachedMax )
+ {
+ QueryMoveFocusEventArgs e = new QueryMoveFocusEventArgs( direction, reachedMax );
+ this.RaiseEvent( e );
+ return e.CanMoveFocus;
+ }
+
+ private bool MoveFocusLeft()
+ {
+ if( this.FlowDirection == FlowDirection.LeftToRight )
+ {
+ //occurs only if the cursor is at the beginning of the text
+ if( ( this.CaretIndex == 0 ) && ( this.SelectionLength == 0 ) )
+ {
+ if( ComponentCommands.MoveFocusBack.CanExecute( null, this ) )
+ {
+ ComponentCommands.MoveFocusBack.Execute( null, this );
+ return true;
+ }
+ else if( this.CanMoveFocus( FocusNavigationDirection.Left, false ) )
+ {
+ this.MoveFocus( new TraversalRequest( FocusNavigationDirection.Left ) );
+ return true;
+ }
+ }
+ }
+ else
+ {
+ //occurs only if the cursor is at the end of the text
+ if( ( this.CaretIndex == this.Text.Length ) && ( this.SelectionLength == 0 ) )
+ {
+ if( ComponentCommands.MoveFocusBack.CanExecute( null, this ) )
+ {
+ ComponentCommands.MoveFocusBack.Execute( null, this );
+ return true;
+ }
+ else if( this.CanMoveFocus( FocusNavigationDirection.Left, false ) )
+ {
+ this.MoveFocus( new TraversalRequest( FocusNavigationDirection.Left ) );
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private bool MoveFocusRight()
+ {
+ if( this.FlowDirection == FlowDirection.LeftToRight )
+ {
+ //occurs only if the cursor is at the beginning of the text
+ if( ( this.CaretIndex == this.Text.Length ) && ( this.SelectionLength == 0 ) )
+ {
+ if( ComponentCommands.MoveFocusForward.CanExecute( null, this ) )
+ {
+ ComponentCommands.MoveFocusForward.Execute( null, this );
+ return true;
+ }
+ else if( this.CanMoveFocus( FocusNavigationDirection.Right, false ) )
+ {
+ this.MoveFocus( new TraversalRequest( FocusNavigationDirection.Right ) );
+ return true;
+ }
+ }
+ }
+ else
+ {
+ //occurs only if the cursor is at the end of the text
+ if( ( this.CaretIndex == 0 ) && ( this.SelectionLength == 0 ) )
+ {
+ if( ComponentCommands.MoveFocusForward.CanExecute( null, this ) )
+ {
+ ComponentCommands.MoveFocusForward.Execute( null, this );
+ return true;
+ }
+ else if( this.CanMoveFocus( FocusNavigationDirection.Right, false ) )
+ {
+ this.MoveFocus( new TraversalRequest( FocusNavigationDirection.Right ) );
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private bool MoveFocusUp()
+ {
+ int lineNumber = this.GetLineIndexFromCharacterIndex( this.SelectionStart );
+
+ //occurs only if the cursor is on the first line
+ if( lineNumber == 0 )
+ {
+ if( ComponentCommands.MoveFocusUp.CanExecute( null, this ) )
+ {
+ ComponentCommands.MoveFocusUp.Execute( null, this );
+ return true;
+ }
+ else if( this.CanMoveFocus( FocusNavigationDirection.Up, false ) )
+ {
+ this.MoveFocus( new TraversalRequest( FocusNavigationDirection.Up ) );
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private bool MoveFocusDown()
+ {
+ int lineNumber = this.GetLineIndexFromCharacterIndex( this.SelectionStart );
+
+ //occurs only if the cursor is on the first line
+ if( lineNumber == ( this.LineCount - 1 ) )
+ {
+ if( ComponentCommands.MoveFocusDown.CanExecute( null, this ) )
+ {
+ ComponentCommands.MoveFocusDown.Execute( null, this );
+ return true;
+ }
+ else if( this.CanMoveFocus( FocusNavigationDirection.Down, false ) )
+ {
+ this.MoveFocus( new TraversalRequest( FocusNavigationDirection.Down ) );
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+}
+
diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AutoSelectTextBox/Implementation/QueryMoveFocusEventArgs.cs b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AutoSelectTextBox/Implementation/QueryMoveFocusEventArgs.cs
new file mode 100644
index 00000000..b77d1772
--- /dev/null
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/AutoSelectTextBox/Implementation/QueryMoveFocusEventArgs.cs
@@ -0,0 +1,76 @@
+/************************************************************************
+
+ Extended WPF Toolkit
+
+ Copyright (C) 2010-2012 Xceed Software Inc.
+
+ This program is provided to you under the terms of the Microsoft Public
+ License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
+
+ This program can be provided to you by Xceed Software Inc. under a
+ proprietary commercial license agreement for use in non-Open Source
+ projects. The commercial version of Extended WPF Toolkit also includes
+ priority technical support, commercial updates, and many additional
+ useful WPF controls if you license Xceed Business Suite for WPF.
+
+ Visit http://xceed.com and follow @datagrid on Twitter.
+
+ **********************************************************************/
+
+using System.Windows;
+using System.Windows.Input;
+
+namespace Xceed.Wpf.Toolkit
+{
+ [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1003:UseGenericEventHandlerInstances" )]
+ public delegate void QueryMoveFocusEventHandler( object sender, QueryMoveFocusEventArgs e );
+
+ public class QueryMoveFocusEventArgs : RoutedEventArgs
+ {
+ //default CTOR private to prevent its usage.
+ private QueryMoveFocusEventArgs()
+ {
+ }
+
+ //internal to prevent anybody from building this type of event.
+ internal QueryMoveFocusEventArgs( FocusNavigationDirection direction, bool reachedMaxLength )
+ : base( AutoSelectTextBox.QueryMoveFocusEvent )
+ {
+ m_navigationDirection = direction;
+ m_reachedMaxLength = reachedMaxLength;
+ }
+
+ public FocusNavigationDirection FocusNavigationDirection
+ {
+ get
+ {
+ return m_navigationDirection;
+ }
+ }
+
+ public bool ReachedMaxLength
+ {
+ get
+ {
+ return m_reachedMaxLength;
+ }
+ }
+
+ public bool CanMoveFocus
+ {
+ get
+ {
+ return m_canMove;
+ }
+ set
+ {
+ m_canMove = value;
+ }
+ }
+
+ private FocusNavigationDirection m_navigationDirection;
+ private bool m_reachedMaxLength;
+ private bool m_canMove = true; //defaults to true... if nobody does nothing, then its capable of moving focus.
+
+ }
+}
diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/CheckComboBox/Implementation/CheckComboBox.cs b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/CheckComboBox/Implementation/CheckComboBox.cs
index be17afce..1b06dc3c 100644
--- a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/CheckComboBox/Implementation/CheckComboBox.cs
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/CheckComboBox/Implementation/CheckComboBox.cs
@@ -22,11 +22,14 @@ using System.Linq;
using System.Windows;
using System.Windows.Input;
using Xceed.Wpf.Toolkit.Primitives;
+using Xceed.Wpf.Toolkit.Core.Utilities;
namespace Xceed.Wpf.Toolkit
{
public class CheckComboBox : Selector
{
+ private ValueChangeHelper _displayMemberPathValuesChangeHelper;
+
#region Constructors
static CheckComboBox()
@@ -37,6 +40,7 @@ namespace Xceed.Wpf.Toolkit
public CheckComboBox()
{
Mouse.AddPreviewMouseDownOutsideCapturedElementHandler( this, OnMouseDownOutsideCapturedElement );
+ _displayMemberPathValuesChangeHelper = new ValueChangeHelper( this.OnDisplayMemberPathValuesChanged );
}
#endregion //Constructors
@@ -98,7 +102,13 @@ namespace Xceed.Wpf.Toolkit
protected override void OnDisplayMemberPathChanged( string oldDisplayMemberPath, string newDisplayMemberPath )
{
base.OnDisplayMemberPathChanged( oldDisplayMemberPath, newDisplayMemberPath );
- UpdateText();
+ this.UpdateDisplayMemberPathValuesBindings();
+ }
+
+ protected override void OnItemsSourceChanged( System.Collections.IEnumerable oldValue, System.Collections.IEnumerable newValue )
+ {
+ base.OnItemsSourceChanged( oldValue, newValue );
+ this.UpdateDisplayMemberPathValuesBindings();
}
#endregion //Base Class Overrides
@@ -114,6 +124,16 @@ namespace Xceed.Wpf.Toolkit
#region Methods
+ private void UpdateDisplayMemberPathValuesBindings()
+ {
+ _displayMemberPathValuesChangeHelper.UpdateValueSource( ItemsCollection, this.DisplayMemberPath );
+ }
+
+ private void OnDisplayMemberPathValuesChanged()
+ {
+ this.UpdateText();
+ }
+
private void UpdateText()
{
#if VS2008
diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/ColorCanvas/Implementation/ColorCanvas.cs b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/ColorCanvas/Implementation/ColorCanvas.cs
index 01a0031c..d0303af0 100644
--- a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/ColorCanvas/Implementation/ColorCanvas.cs
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/ColorCanvas/Implementation/ColorCanvas.cs
@@ -25,17 +25,20 @@ using System.Windows.Media;
using Xceed.Wpf.Toolkit.Core.Utilities;
using Xceed.Wpf.Toolkit.Primitives;
using System.IO;
+using System;
namespace Xceed.Wpf.Toolkit
{
[TemplatePart( Name = PART_ColorShadingCanvas, Type = typeof( Canvas ) )]
[TemplatePart( Name = PART_ColorShadeSelector, Type = typeof( Canvas ) )]
[TemplatePart( Name = PART_SpectrumSlider, Type = typeof( ColorSpectrumSlider ) )]
+ [TemplatePart( Name = PART_HexadecimalTextBox, Type = typeof( TextBox ) )]
public class ColorCanvas : Control
{
private const string PART_ColorShadingCanvas = "PART_ColorShadingCanvas";
private const string PART_ColorShadeSelector = "PART_ColorShadeSelector";
private const string PART_SpectrumSlider = "PART_SpectrumSlider";
+ private const string PART_HexadecimalTextBox = "PART_HexadecimalTextBox";
#region Private Members
@@ -43,6 +46,7 @@ namespace Xceed.Wpf.Toolkit
private Canvas _colorShadingCanvas;
private Canvas _colorShadeSelector;
private ColorSpectrumSlider _spectrumSlider;
+ private TextBox _hexadecimalTextBox;
private Point? _currentColorPosition;
private bool _surpressPropertyChanged;
@@ -74,7 +78,7 @@ namespace Xceed.Wpf.Toolkit
protected virtual void OnSelectedColorChanged( Color oldValue, Color newValue )
{
- HexadecimalString = GetFormatedColorString( newValue );
+ SetHexadecimalStringProperty( GetFormatedColorString( newValue ), false );
UpdateRGBValues( newValue );
UpdateColorShadeSelectorPosition( newValue );
@@ -237,6 +241,8 @@ namespace Xceed.Wpf.Toolkit
string currentColorString = GetFormatedColorString( SelectedColor );
if( !currentColorString.Equals( newColorString ) )
UpdateSelectedColor( ( Color )ColorConverter.ConvertFromString( newColorString ) );
+
+ SetHexadecimalTextBoxTextProperty( newValue );
}
private static object OnCoerceHexadecimalString( DependencyObject d, object basevalue )
@@ -251,16 +257,19 @@ namespace Xceed.Wpf.Toolkit
private object OnCoerceHexadecimalString( object newValue )
{
var value = newValue as string;
+ string retValue = value;
+
try
{
ColorConverter.ConvertFromString( value );
}
catch
{
+ //When HexadecimalString is changed via Code-Behind and hexadecimal format is bad, throw.
throw new InvalidDataException( "Color provided is not in the correct format." );
}
- return value;
+ return retValue;
}
#endregion //HexadecimalString
@@ -289,7 +298,7 @@ namespace Xceed.Wpf.Toolkit
protected virtual void OnUsingAlphaChannelChanged()
{
- HexadecimalString = GetFormatedColorString( SelectedColor );
+ SetHexadecimalStringProperty( GetFormatedColorString( SelectedColor ), false );
}
#endregion //UsingAlphaChannel
@@ -342,17 +351,31 @@ namespace Xceed.Wpf.Toolkit
if( _spectrumSlider != null )
_spectrumSlider.ValueChanged += SpectrumSlider_ValueChanged;
+ if( _hexadecimalTextBox != null )
+ _hexadecimalTextBox.LostFocus -= new RoutedEventHandler( HexadecimalTextBox_LostFocus );
+
+ _hexadecimalTextBox = GetTemplateChild( PART_HexadecimalTextBox ) as TextBox;
+
+ if( _hexadecimalTextBox != null )
+ _hexadecimalTextBox.LostFocus += new RoutedEventHandler( HexadecimalTextBox_LostFocus );
+
UpdateRGBValues( SelectedColor );
UpdateColorShadeSelectorPosition( SelectedColor );
+
+ // When changing theme, HexadecimalString needs to be set since it is not binded.
+ SetHexadecimalTextBoxTextProperty( GetFormatedColorString( SelectedColor ) );
}
- protected override void OnPreviewKeyDown( KeyEventArgs e )
+ protected override void OnKeyDown( KeyEventArgs e )
{
- //hitting enter on textbox will update value of underlying source
+ base.OnKeyDown( e );
+
+ //hitting enter on textbox will update Hexadecimal string
if( e.Key == Key.Enter && e.OriginalSource is TextBox )
{
- BindingExpression be = ( ( TextBox )e.OriginalSource ).GetBindingExpression( TextBox.TextProperty );
- be.UpdateSource();
+ TextBox textBox = ( TextBox )e.OriginalSource;
+ if( textBox.Name == PART_HexadecimalTextBox )
+ SetHexadecimalStringProperty( textBox.Text, true );
}
}
@@ -404,6 +427,12 @@ namespace Xceed.Wpf.Toolkit
}
}
+ void HexadecimalTextBox_LostFocus( object sender, RoutedEventArgs e )
+ {
+ TextBox textbox = sender as TextBox;
+ SetHexadecimalStringProperty( textbox.Text, true );
+ }
+
#endregion //Event Handlers
#region Events
@@ -503,7 +532,7 @@ namespace Xceed.Wpf.Toolkit
var currentColor = ColorUtilities.ConvertHsvToRgb( hsv.H, hsv.S, hsv.V );
currentColor.A = A;
SelectedColor = currentColor;
- HexadecimalString = GetFormatedColorString( SelectedColor );
+ SetHexadecimalStringProperty( GetFormatedColorString( SelectedColor ), false );
}
private string GetFormatedColorString( Color colorToFormat )
@@ -516,6 +545,34 @@ namespace Xceed.Wpf.Toolkit
return ColorUtilities.FormatColorString( stringToFormat, UsingAlphaChannel );
}
+ private void SetHexadecimalStringProperty( string newValue, bool modifyFromUI )
+ {
+ if( modifyFromUI )
+ {
+ try
+ {
+ ColorConverter.ConvertFromString( newValue );
+ HexadecimalString = newValue;
+ }
+ catch
+ {
+ //When HexadecimalString is changed via UI and hexadecimal format is bad, keep the previous HexadecimalString.
+ SetHexadecimalTextBoxTextProperty( HexadecimalString );
+ }
+ }
+ else
+ {
+ //When HexadecimalString is changed via Code-Behind, hexadecimal format will be evaluated in OnCoerceHexadecimalString()
+ HexadecimalString = newValue;
+ }
+ }
+
+ private void SetHexadecimalTextBoxTextProperty( string newValue )
+ {
+ if( _hexadecimalTextBox != null )
+ _hexadecimalTextBox.Text = newValue;
+ }
+
#endregion //Methods
}
}
diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/ColorCanvas/Themes/Generic.xaml b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/ColorCanvas/Themes/Generic.xaml
index 7164d0a0..4bb44947 100644
--- a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/ColorCanvas/Themes/Generic.xaml
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/ColorCanvas/Themes/Generic.xaml
@@ -260,7 +260,7 @@
-
+
diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/ColorPicker/Implementation/ColorPicker.cs b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/ColorPicker/Implementation/ColorPicker.cs
index 42aca48a..899743e0 100644
--- a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/ColorPicker/Implementation/ColorPicker.cs
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/ColorPicker/Implementation/ColorPicker.cs
@@ -343,7 +343,7 @@ namespace Xceed.Wpf.Toolkit
{
return ( bool )GetValue( UsingAlphaChannelProperty );
}
- protected set
+ set
{
SetValue( UsingAlphaChannelProperty, value );
}
diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Converters/WizardPageButtonVisibilityConverter.cs b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Converters/WizardPageButtonVisibilityConverter.cs
index 1c8bc7a9..317fafbf 100644
--- a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Converters/WizardPageButtonVisibilityConverter.cs
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Converters/WizardPageButtonVisibilityConverter.cs
@@ -28,7 +28,9 @@ namespace Xceed.Wpf.Toolkit.Core.Converters
public object Convert( object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{
Visibility wizardVisibility = ( Visibility )values[ 0 ];
- WizardPageButtonVisibility wizardPageVisibility = ( WizardPageButtonVisibility )values[ 1 ];
+ WizardPageButtonVisibility wizardPageVisibility = ( (values[ 1 ] == null) || (values[ 1 ] == DependencyProperty.UnsetValue) )
+ ? WizardPageButtonVisibility.Hidden
+ : ( WizardPageButtonVisibility )values[ 1 ];
Visibility visibility = Visibility.Visible;
diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Input/IValidateInput.cs b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Input/IValidateInput.cs
new file mode 100644
index 00000000..15d600da
--- /dev/null
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Input/IValidateInput.cs
@@ -0,0 +1,32 @@
+/************************************************************************
+
+ Extended WPF Toolkit
+
+ Copyright (C) 2010-2012 Xceed Software Inc.
+
+ This program is provided to you under the terms of the Microsoft Public
+ License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
+
+ This program can be provided to you by Xceed Software Inc. under a
+ proprietary commercial license agreement for use in non-Open Source
+ projects. The commercial version of Extended WPF Toolkit also includes
+ priority technical support, commercial updates, and many additional
+ useful WPF controls if you license Xceed Business Suite for WPF.
+
+ Visit http://xceed.com and follow @datagrid on Twitter.
+
+ **********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Xceed.Wpf.Toolkit.Core.Input
+{
+ public interface IValidateInput
+ {
+ event InputValidationErrorEventHandler InputValidationError;
+ void CommitInput();
+ }
+}
diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Input/InputValidationErrorEventArgs.cs b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Input/InputValidationErrorEventArgs.cs
new file mode 100644
index 00000000..312c90ce
--- /dev/null
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Input/InputValidationErrorEventArgs.cs
@@ -0,0 +1,46 @@
+/************************************************************************
+
+ Extended WPF Toolkit
+
+ Copyright (C) 2010-2012 Xceed Software Inc.
+
+ This program is provided to you under the terms of the Microsoft Public
+ License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
+
+ This program can be provided to you by Xceed Software Inc. under a
+ proprietary commercial license agreement for use in non-Open Source
+ projects. The commercial version of Extended WPF Toolkit also includes
+ priority technical support, commercial updates, and many additional
+ useful WPF controls if you license Xceed Business Suite for WPF.
+
+ Visit http://xceed.com and follow @datagrid on Twitter.
+
+ **********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Xceed.Wpf.Toolkit.Core.Input
+{
+ public delegate void InputValidationErrorEventHandler( object sender, InputValidationErrorEventArgs e );
+
+ public class InputValidationErrorEventArgs : EventArgs
+ {
+ public InputValidationErrorEventArgs( string errorMsg )
+ {
+ _errorMessage = errorMsg;
+ }
+
+ public string ErrorMessage
+ {
+ get
+ {
+ return _errorMessage;
+ }
+ }
+
+ private string _errorMessage;
+ }
+}
diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Primitives/CachedTextInfo.cs b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Primitives/CachedTextInfo.cs
new file mode 100644
index 00000000..d887ffb8
--- /dev/null
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Primitives/CachedTextInfo.cs
@@ -0,0 +1,57 @@
+/************************************************************************
+
+ Extended WPF Toolkit
+
+ Copyright (C) 2010-2012 Xceed Software Inc.
+
+ This program is provided to you under the terms of the Microsoft Public
+ License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
+
+ This program can be provided to you by Xceed Software Inc. under a
+ proprietary commercial license agreement for use in non-Open Source
+ projects. The commercial version of Extended WPF Toolkit also includes
+ priority technical support, commercial updates, and many additional
+ useful WPF controls if you license Xceed Business Suite for WPF.
+
+ Visit http://xceed.com and follow @datagrid on Twitter.
+
+ **********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows.Controls;
+
+namespace Xceed.Wpf.Toolkit.Primitives
+{
+ internal class CachedTextInfo : ICloneable
+ {
+ private CachedTextInfo( string text, int caretIndex, int selectionStart, int selectionLength )
+ {
+ this.Text = text;
+ this.CaretIndex = caretIndex;
+ this.SelectionStart = selectionStart;
+ this.SelectionLength = selectionLength;
+ }
+
+ public CachedTextInfo( TextBox textBox )
+ : this( textBox.Text, textBox.CaretIndex, textBox.SelectionStart, textBox.SelectionLength )
+ {
+ }
+
+ public string Text { get; private set; }
+ public int CaretIndex { get; private set; }
+ public int SelectionStart { get; private set; }
+ public int SelectionLength { get; private set; }
+
+ #region ICloneable Members
+
+ public object Clone()
+ {
+ return new CachedTextInfo( this.Text, this.CaretIndex, this.SelectionStart, this.SelectionLength );
+ }
+
+ #endregion
+ }
+}
diff --git a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Primitives/Selector.cs b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Primitives/Selector.cs
index f8cfcd3f..12c902f4 100644
--- a/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Primitives/Selector.cs
+++ b/ExtendedWPFToolkitSolution_35/Src/WPFToolkit.Extended/Core/Primitives/Selector.cs
@@ -26,16 +26,28 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Reflection;
+using Xceed.Wpf.Toolkit.Core.Utilities;
namespace Xceed.Wpf.Toolkit.Primitives
{
- public class Selector : ItemsControl //should probably make this control an ICommandSource
+ public class Selector : ItemsControl, IWeakEventListener //should probably make this control an ICommandSource
{
#region Members
- private bool _ignoreSetSelectedValue;
- private bool _surpressSelectionChanged;
- private bool _surpressSelectedValueChanged;
+ private bool _surpressItemSelectionChanged;
+ private bool _ignoreSelectedItemChanged;
+ private bool _ignoreSelectedValueChanged;
+ private int _ignoreSelectedItemsCollectionChanged;
+ private int _ignoreSelectedMemberPathValuesChanged;
+ private IList _selectedItems;
+
+ private ValueChangeHelper _selectedMemberPathValuesHelper;
+ private ValueChangeHelper _valueMemberPathValuesHelper;
+
+
#endregion //Members
@@ -43,9 +55,11 @@ namespace Xceed.Wpf.Toolkit.Primitives
public Selector()
{
- SelectedItems = new ObservableCollection