From 5a8bbe7895792f6cd7fa6a76b77f9330e996d6a6 Mon Sep 17 00:00:00 2001 From: Simon Boucher Date: Thu, 2 Dec 2021 12:43:30 -0500 Subject: [PATCH] V4.2.0 Released --- .../Controls/AnchorablePaneTabPanel.cs | 15 - .../Controls/DropTarget.cs | 1 + .../Controls/LayoutAnchorableItem.cs | 2 +- .../Controls/LayoutAnchorableTabItem.cs | 157 +++++--- .../Controls/LayoutDocumentTabItem.cs | 60 +++- .../Controls/LayoutItem.cs | 6 +- .../Controls/LayoutPanelControl.cs | 181 +++++----- .../Controls/Shell/Standard/NativeMethods.cs | 33 +- .../Controls/Shell/Standard/Utilities.cs | 6 +- .../Xceed.Wpf.AvalonDock/DockingManager.cs | 10 +- .../Layout/LayoutContent.cs | 18 +- .../Src/Xceed.Wpf.AvalonDock/Win32Helper.cs | 2 + ...PropertyGridDefaultEditorsView.xaml.cs.txt | 4 + .../Properties/AssemblyInfo.cs | 2 +- .../PropertyGridDefaultEditorsView.xaml.cs | 4 + .../Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs | 2 +- .../Implementation/ButtonSpinner.cs | 186 +++++++++- .../Themes/Aero2.NormalColor.xaml | 25 +- .../ButtonSpinner/Themes/Generic.xaml | 25 +- .../Implementation/CalculatorUpDown.cs | 68 ++++ .../Themes/Aero2.NormalColor.xaml | 48 +-- .../CalculatorUpDown/Themes/Generic.xaml | 48 +-- .../CollectionControlDialog.xaml.cs | 8 +- .../ColorPicker/Themes/Aero2.NormalColor.xaml | 2 +- .../ColorPicker/Themes/Generic.xaml | 2 +- .../Core/Media/WindowColors.cs | 6 +- .../Core/PackUriExtension.cs | 2 + .../Implementation/DateTimePicker.cs | 2 + .../Themes/Aero2.NormalColor.xaml | 48 +-- .../DateTimePicker/Themes/Generic.xaml | 48 +-- .../Themes/Aero2.NormalColor.xaml | 35 +- .../DateTimeUpDown/Themes/Generic.xaml | 25 +- .../Implementation/MaskedTextBox.cs | 83 +++-- .../MessageBox/Implementation/MessageBox.cs | 4 +- .../Themes/Aero2.NormalColor.xaml | 13 +- .../NumericUpDown/Themes/Generic.xaml | 13 +- .../Primitives/DateTimePickerBase.cs | 68 ++++ .../Primitives/SelectAllSelector.cs | 20 +- .../Themes/Aero2/WindowControl.xaml | 2 +- .../Primitives/UpDownBase.cs | 102 ++++++ .../Primitives/ValueRangeTextBox.cs | 11 +- .../Properties/AssemblyInfo.cs | 2 + .../Converters/PropertyItemEditorConverter.cs | 2 - .../DescriptorPropertyDefinition.cs | 4 + .../Implementation/Editors/PasswordEditor.cs | 71 ++++ .../Implementation/Editors/TextBlockEditor.cs | 21 ++ .../ObjectContainerHelperBase.cs | 10 +- .../Implementation/PropertyItem.cs | 13 +- .../Themes/Aero2.NormalColor.xaml | 7 + .../PropertyGrid/Themes/Generic.xaml | 7 + .../Themes/Aero2/Common.xaml | 4 +- .../Themes/Aero2/Glyphs.xaml | 22 ++ .../Themes/Generic/Glyphs.xaml | 22 ++ .../TimePicker/Implementation/TimePicker.cs | 2 +- .../TimePicker/Themes/Aero2.NormalColor.xaml | 48 +-- .../TimePicker/Themes/Generic.xaml | 48 +-- .../Themes/Aero2.NormalColor.xaml | 29 +- .../TimeSpanUpDown/Themes/Generic.xaml | 23 +- .../Utils/Exceptions/ThrowException.cs | 4 +- .../Xceed.Wpf.Toolkit.csproj | 1 + .../Src/Xceed.Wpf.Toolkit/Zoombox/Zoombox.cs | 336 +++++++++--------- .../Zoombox/ZoomboxCursors.cs | 2 + 62 files changed, 1450 insertions(+), 625 deletions(-) create mode 100644 ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/PasswordEditor.cs diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AnchorablePaneTabPanel.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AnchorablePaneTabPanel.cs index 45c0b1c98..282490bf4 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AnchorablePaneTabPanel.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/AnchorablePaneTabPanel.cs @@ -93,21 +93,6 @@ protected override Size ArrangeOverride( Size finalSize ) return finalSize; } - protected override void OnMouseLeave( System.Windows.Input.MouseEventArgs e ) - { - if( e.LeftButton == System.Windows.Input.MouseButtonState.Pressed && - LayoutAnchorableTabItem.IsDraggingItem() ) - { - var contentModel = LayoutAnchorableTabItem.GetDraggingItem().Model as LayoutAnchorable; - var manager = contentModel.Root.Manager; - LayoutAnchorableTabItem.ResetDraggingItem(); - - manager.StartDraggingFloatingWindowForContent( contentModel ); - } - - base.OnMouseLeave( e ); - } - #endregion } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropTarget.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropTarget.cs index 64a1b7094..624dcb9fc 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropTarget.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/DropTarget.cs @@ -119,6 +119,7 @@ public void Drop( LayoutFloatingWindow floatingWindow ) currentActiveContent.IsSelected = false; currentActiveContent.IsActive = false; currentActiveContent.IsActive = true; + currentActiveContent.IsFloating = false; } ), DispatcherPriority.Background ); } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableItem.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableItem.cs index 78c85f9b6..3c9cf4e9c 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableItem.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableItem.cs @@ -352,7 +352,7 @@ protected override void SetDefaultBindings() if( DockCommand == null ) this.SetCurrentValue( LayoutAnchorableItem.DockCommandProperty, _defaultDockCommand ); - Visibility = _anchorable.IsVisible ? Visibility.Visible : System.Windows.Visibility.Hidden; + this.SetCurrentValue( LayoutAnchorableItem.VisibilityProperty, _anchorable.IsVisible ? Visibility.Visible : System.Windows.Visibility.Hidden ); base.SetDefaultBindings(); } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs index 6b4a70753..e0b88aad5 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutAnchorableTabItem.cs @@ -15,6 +15,8 @@ COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at ***********************************************************************************/ +using System; +using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; @@ -27,9 +29,17 @@ public class LayoutAnchorableTabItem : Control { #region Members + private static double MinDragBuffer = 5d; + private static double MaxDragBuffer = 50d; + private bool _isMouseDown = false; - private static LayoutAnchorableTabItem _draggingItem = null; - private static bool _cancelMouseLeave = false; + private Point _mouseDownPoint; + private double _mouseLastChangePositionX; + private Rect _parentAnchorableTabPanelScreenArea; + private List _otherTabsScreenArea = null; + private List _otherTabs = null; + private AnchorablePaneTabPanel _parentAnchorableTabPanel; + private double _dragBuffer = MinDragBuffer; #endregion @@ -136,98 +146,127 @@ protected override void OnMouseLeftButtonDown( System.Windows.Input.MouseButtonE base.OnMouseLeftButtonDown( e ); _isMouseDown = true; - _draggingItem = this; + _mouseDownPoint = e.GetPosition( this ); } protected override void OnMouseMove( System.Windows.Input.MouseEventArgs e ) { base.OnMouseMove( e ); - if( e.LeftButton != MouseButtonState.Pressed ) + var ptMouseMove = e.GetPosition( this ); + + if( _isMouseDown ) { - _isMouseDown = false; - _draggingItem = null; + if( Math.Abs( ptMouseMove.X - _mouseDownPoint.X ) > SystemParameters.MinimumHorizontalDragDistance || + Math.Abs( ptMouseMove.Y - _mouseDownPoint.Y ) > SystemParameters.MinimumVerticalDragDistance ) + { + this.UpdateDragDetails(); + this.CaptureMouse(); + _isMouseDown = false; + } } - else + + if( this.IsMouseCaptured ) { - _cancelMouseLeave = false; + var mousePosInScreenCoord = this.PointToScreenDPI( ptMouseMove ); + + if( !_parentAnchorableTabPanelScreenArea.Contains( mousePosInScreenCoord ) ) + { + var contentModel = this.Model as LayoutAnchorable; + var manager = contentModel.Root.Manager; + this.ReleaseMouseCapture(); + manager.StartDraggingFloatingWindowForContent( contentModel ); + } + else + { + int indexOfTabItemWithMouseOver = _otherTabsScreenArea.FindIndex( r => r.Contains( mousePosInScreenCoord ) ); + if( indexOfTabItemWithMouseOver >= 0 ) + { + var targetModel = _otherTabs[ indexOfTabItemWithMouseOver ].Content as LayoutContent; + var container = this.Model.Parent as ILayoutContainer; + var containerPane = this.Model.Parent as ILayoutPane; + var currentTabScreenArea = this.FindLogicalAncestor().GetScreenArea(); + + // Inside current TabItem, do not care about _mouseLastChangePosition for next change position. + if( targetModel == this.Model ) + { + _mouseLastChangePositionX = currentTabScreenArea.Left + ( currentTabScreenArea.Width / 2 ); + } + + if( ( containerPane is LayoutAnchorablePane ) && !( (LayoutAnchorablePane)containerPane ).CanRepositionItems ) + return; + if( ( containerPane.Parent != null ) && ( containerPane.Parent is LayoutAnchorablePaneGroup ) && !( (LayoutAnchorablePaneGroup)containerPane.Parent ).CanRepositionItems ) + return; + + var childrenList = container.Children.ToList(); + var currentIndex = childrenList.IndexOf( this.Model ); + var newIndex = childrenList.IndexOf( targetModel ); + + if( currentIndex != newIndex ) + { + // Moving left when cursor leave tabItem or moving left past last change position. + // Or, moving right cursor leave tabItem or moving right past last change position. + if( ( ( mousePosInScreenCoord.X < currentTabScreenArea.Left ) && ( mousePosInScreenCoord.X < _mouseLastChangePositionX ) ) + || ( ( mousePosInScreenCoord.X > ( currentTabScreenArea.Left + currentTabScreenArea.Width ) ) && ( mousePosInScreenCoord.X > _mouseLastChangePositionX ) ) ) + { + containerPane.MoveChild( currentIndex, newIndex ); + _dragBuffer = MaxDragBuffer; + _parentAnchorableTabPanel.UpdateLayout(); + this.UpdateDragDetails(); + _mouseLastChangePositionX = mousePosInScreenCoord.X; + } + } + } + } } } protected override void OnMouseLeftButtonUp( System.Windows.Input.MouseButtonEventArgs e ) { + if( this.IsMouseCaptured ) + { + this.ReleaseMouseCapture(); + } _isMouseDown = false; + _dragBuffer = MinDragBuffer; base.OnMouseLeftButtonUp( e ); - Model.IsActive = true; + this.Model.IsActive = true; } protected override void OnMouseLeave( System.Windows.Input.MouseEventArgs e ) { base.OnMouseLeave( e ); - - if( _isMouseDown && e.LeftButton == MouseButtonState.Pressed ) - { - // drag the item if the mouse leave is not canceled. - // Mouse leave should be canceled when selecting a new tab to prevent automatic undock when Panel size is Auto. - _draggingItem = !_cancelMouseLeave ? this : null; - } - _isMouseDown = false; - _cancelMouseLeave = false; } protected override void OnMouseEnter( MouseEventArgs e ) { base.OnMouseEnter( e ); - - if( _draggingItem != null - && _draggingItem != this - && e.LeftButton == MouseButtonState.Pressed ) - { - var model = Model; - var container = model.Parent as ILayoutContainer; - var containerPane = model.Parent as ILayoutPane; - - if( ( containerPane is LayoutAnchorablePane ) && !( ( LayoutAnchorablePane )containerPane ).CanRepositionItems ) - return; - if( ( containerPane.Parent != null ) && ( containerPane.Parent is LayoutAnchorablePaneGroup ) && !( ( LayoutAnchorablePaneGroup )containerPane.Parent ).CanRepositionItems ) - return; - - var childrenList = container.Children.ToList(); - containerPane.MoveChild( childrenList.IndexOf( _draggingItem.Model ), childrenList.IndexOf( model ) ); - } - } - - protected override void OnPreviewGotKeyboardFocus( KeyboardFocusChangedEventArgs e ) - { - base.OnPreviewGotKeyboardFocus( e ); - + _isMouseDown = false; } #endregion - #region Internal Methods - - internal static bool IsDraggingItem() - { - return _draggingItem != null; - } + #region Private Methods - internal static LayoutAnchorableTabItem GetDraggingItem() + private void UpdateDragDetails() { - return _draggingItem; - } - internal static void ResetDraggingItem() - { - _draggingItem = null; - } - internal static void CancelMouseLeave() - { - _cancelMouseLeave = true; + _parentAnchorableTabPanel = this.FindLogicalAncestor(); + _parentAnchorableTabPanelScreenArea = _parentAnchorableTabPanel.GetScreenArea(); + _parentAnchorableTabPanelScreenArea.Inflate( 0, _dragBuffer ); + _otherTabs = _parentAnchorableTabPanel.Children.Cast().Where( ch => ch.Visibility != System.Windows.Visibility.Collapsed ).ToList(); + var currentTabScreenArea = this.FindLogicalAncestor().GetScreenArea(); + _otherTabsScreenArea = _otherTabs.Select( ti => + { + var screenArea = ti.GetScreenArea(); + var rect = new Rect( screenArea.Left, screenArea.Top, screenArea.Width, screenArea.Height ); + rect.Inflate( 0, _dragBuffer ); + return rect; + } ).ToList(); } - #endregion -} + #endregion + } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentTabItem.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentTabItem.cs index 4a6a7332b..d3286ab4e 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentTabItem.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutDocumentTabItem.cs @@ -29,12 +29,17 @@ public class LayoutDocumentTabItem : Control { #region Members + private static double MinDragBuffer = 5d; + private static double MaxDragBuffer = 50d; + private List _otherTabsScreenArea = null; private List _otherTabs = null; private Rect _parentDocumentTabPanelScreenArea; private DocumentPaneTabPanel _parentDocumentTabPanel; private bool _isMouseDown = false; private Point _mouseDownPoint; + private double _mouseLastChangePositionX; + private double _dragBuffer = MinDragBuffer; #endregion @@ -159,10 +164,10 @@ protected override void OnMouseMove( System.Windows.Input.MouseEventArgs e ) { base.OnMouseMove( e ); + var ptMouseMove = e.GetPosition( this ); + if( _isMouseDown ) { - Point ptMouseMove = e.GetPosition( this ); - if( Math.Abs( ptMouseMove.X - _mouseDownPoint.X ) > SystemParameters.MinimumHorizontalDragDistance || Math.Abs( ptMouseMove.Y - _mouseDownPoint.Y ) > SystemParameters.MinimumVerticalDragDistance ) { @@ -174,7 +179,8 @@ protected override void OnMouseMove( System.Windows.Input.MouseEventArgs e ) if( this.IsMouseCaptured ) { - var mousePosInScreenCoord = this.PointToScreenDPI( e.GetPosition( this ) ); + var mousePosInScreenCoord = this.PointToScreenDPI( ptMouseMove ); + if( !_parentDocumentTabPanelScreenArea.Contains( mousePosInScreenCoord ) ) { this.StartDraggingFloatingWindowForContent(); @@ -187,17 +193,38 @@ protected override void OnMouseMove( System.Windows.Input.MouseEventArgs e ) var targetModel = _otherTabs[ indexOfTabItemWithMouseOver ].Content as LayoutContent; var container = this.Model.Parent as ILayoutContainer; var containerPane = this.Model.Parent as ILayoutPane; + var currentTabScreenArea = this.FindLogicalAncestor().GetScreenArea(); - if( ( containerPane is LayoutDocumentPane ) && !( ( LayoutDocumentPane )containerPane ).CanRepositionItems ) + // Inside current TabItem, do not care about _mouseLastChangePosition for next change position. + if( targetModel == this.Model ) + { + _mouseLastChangePositionX = currentTabScreenArea.Left + ( currentTabScreenArea.Width / 2 ); + } + + if( ( containerPane is LayoutDocumentPane ) && !( (LayoutDocumentPane)containerPane ).CanRepositionItems ) return; - if( ( containerPane.Parent != null ) && ( containerPane.Parent is LayoutDocumentPaneGroup ) && !( ( LayoutDocumentPaneGroup )containerPane.Parent ).CanRepositionItems ) + if( ( containerPane.Parent != null ) && ( containerPane.Parent is LayoutDocumentPaneGroup ) && !( (LayoutDocumentPaneGroup)containerPane.Parent ).CanRepositionItems ) return; var childrenList = container.Children.ToList(); - containerPane.MoveChild( childrenList.IndexOf( Model ), childrenList.IndexOf( targetModel ) ); - this.Model.IsActive = true; - _parentDocumentTabPanel.UpdateLayout(); - this.UpdateDragDetails(); + var currentIndex = childrenList.IndexOf( this.Model ); + var newIndex = childrenList.IndexOf( targetModel ); + + if( currentIndex != newIndex ) + { + // Moving left when cursor leave tabItem or moving left past last change position. + // Or, moving right cursor leave tabItem or moving right past last change position. + if( ( ( mousePosInScreenCoord.X < currentTabScreenArea.Left ) && ( mousePosInScreenCoord.X < _mouseLastChangePositionX ) ) + || ( ( mousePosInScreenCoord.X > ( currentTabScreenArea.Left + currentTabScreenArea.Width ) ) && ( mousePosInScreenCoord.X > _mouseLastChangePositionX ) ) ) + { + containerPane.MoveChild( currentIndex, newIndex ); + _dragBuffer = MaxDragBuffer; + this.Model.IsActive = true; + _parentDocumentTabPanel.UpdateLayout(); + this.UpdateDragDetails(); + _mouseLastChangePositionX = mousePosInScreenCoord.X; + } + } } } } @@ -206,8 +233,11 @@ protected override void OnMouseMove( System.Windows.Input.MouseEventArgs e ) protected override void OnMouseLeftButtonUp( System.Windows.Input.MouseButtonEventArgs e ) { if( IsMouseCaptured ) - ReleaseMouseCapture(); + { + this.ReleaseMouseCapture(); + } _isMouseDown = false; + _dragBuffer = MinDragBuffer; base.OnMouseLeftButtonUp( e ); } @@ -243,13 +273,15 @@ private void UpdateDragDetails() { _parentDocumentTabPanel = this.FindLogicalAncestor(); _parentDocumentTabPanelScreenArea = _parentDocumentTabPanel.GetScreenArea(); - _otherTabs = _parentDocumentTabPanel.Children.Cast().Where( ch => - ch.Visibility != System.Windows.Visibility.Collapsed ).ToList(); - Rect currentTabScreenArea = this.FindLogicalAncestor().GetScreenArea(); + _parentDocumentTabPanelScreenArea.Inflate( 0, _dragBuffer ); + _otherTabs = _parentDocumentTabPanel.Children.Cast().Where( ch => ch.Visibility != System.Windows.Visibility.Collapsed ).ToList(); + var currentTabScreenArea = this.FindLogicalAncestor().GetScreenArea(); _otherTabsScreenArea = _otherTabs.Select( ti => { var screenArea = ti.GetScreenArea(); - return new Rect( screenArea.Left, screenArea.Top, currentTabScreenArea.Width, screenArea.Height ); + var rect = new Rect( screenArea.Left, screenArea.Top, screenArea.Width, screenArea.Height ); + rect.Inflate( 0, _dragBuffer ); + return rect; } ).ToList(); } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutItem.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutItem.cs index 4071d2c8c..61abd3329 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutItem.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutItem.cs @@ -1181,9 +1181,9 @@ protected virtual void SetDefaultBindings() this.SetCurrentValue( LayoutItem.MoveToPreviousTabGroupCommandProperty, _defaultMoveToPreviousTabGroupCommand ); - IsSelected = LayoutElement.IsSelected; - IsActive = LayoutElement.IsActive; - CanClose = LayoutElement.CanClose; + this.SetCurrentValue( LayoutItem.IsSelectedProperty, LayoutElement.IsSelected ); + this.SetCurrentValue( LayoutItem.IsActiveProperty, LayoutElement.IsActive ); + this.SetCurrentValue( LayoutItem.CanCloseProperty, LayoutElement.CanClose ); } protected virtual void OnVisibilityChanged() diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutPanelControl.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutPanelControl.cs index 53e99f4e0..428b528ea 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutPanelControl.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutPanelControl.cs @@ -45,96 +45,97 @@ internal LayoutPanelControl( LayoutPanel model ) protected override void OnFixChildrenDockLengths() { - if( ActualWidth == 0.0 || - ActualHeight == 0.0 ) - return; - - var modelAsPositionableElement = _model as ILayoutPositionableElementWithActualSize; - #region Setup DockWidth/Height for children - if( _model.Orientation == Orientation.Horizontal ) - { - if( _model.ContainsChildOfType() ) - { - for( int i = 0; i < _model.Children.Count; i++ ) - { - var childContainerModel = _model.Children[ i ] as ILayoutContainer; - var childPositionableModel = _model.Children[ i ] as ILayoutPositionableElement; - - if( childContainerModel != null && - ( childContainerModel.IsOfType() || - childContainerModel.ContainsChildOfType() ) ) - { - // childPositionableModel.DockWidth = new GridLength( 1.0, GridUnitType.Star ); - } - else if( (childPositionableModel != null) && childPositionableModel.DockWidth.IsStar ) - { - var childPositionableModelWidthActualSize = childPositionableModel as ILayoutPositionableElementWithActualSize; - if( childPositionableModelWidthActualSize.ActualWidth == 0d ) - continue; - - var widthToSet = Math.Max( childPositionableModelWidthActualSize.ActualWidth, childPositionableModel.DockMinWidth ); - - widthToSet = Math.Min( widthToSet, ActualWidth / 2.0 ); - widthToSet = Math.Max( widthToSet, childPositionableModel.DockMinWidth ); - - childPositionableModel.DockWidth = new GridLength( double.IsNaN( widthToSet ) ? ActualWidth / 2.0 : widthToSet, GridUnitType.Pixel ); - } - } - } - //else - //{ - // for( int i = 0; i < _model.Children.Count; i++ ) - // { - // var childPositionableModel = _model.Children[ i ] as ILayoutPositionableElement; - // if( !childPositionableModel.DockWidth.IsStar ) - // { - // childPositionableModel.DockWidth = new GridLength( 1.0, GridUnitType.Star ); - // } - // } - //} - } - else - { - if( _model.ContainsChildOfType() ) - { - for( int i = 0; i < _model.Children.Count; i++ ) - { - var childContainerModel = _model.Children[ i ] as ILayoutContainer; - var childPositionableModel = _model.Children[ i ] as ILayoutPositionableElement; - - if( childContainerModel != null && - ( childContainerModel.IsOfType() || - childContainerModel.ContainsChildOfType() ) ) - { - //childPositionableModel.DockHeight = new GridLength( 1.0, GridUnitType.Star ); - } - else if( (childPositionableModel != null) && childPositionableModel.DockHeight.IsStar ) - { - var childPositionableModelWidthActualSize = childPositionableModel as ILayoutPositionableElementWithActualSize; - if( childPositionableModelWidthActualSize.ActualHeight == 0d ) - continue; - - var heightToSet = Math.Max( childPositionableModelWidthActualSize.ActualHeight, childPositionableModel.DockMinHeight ); - heightToSet = Math.Min( heightToSet, ActualHeight / 2.0 ); - heightToSet = Math.Max( heightToSet, childPositionableModel.DockMinHeight ); - - childPositionableModel.DockHeight = new GridLength( double.IsNaN( heightToSet ) ? ActualHeight / 2.0 : heightToSet, GridUnitType.Pixel ); - } - } - } - //else - //{ - // for( int i = 0; i < _model.Children.Count; i++ ) - // { - // var childPositionableModel = _model.Children[ i ] as ILayoutPositionableElement; - // if( !childPositionableModel.DockHeight.IsStar ) - // { - // childPositionableModel.DockHeight = new GridLength( 1.0, GridUnitType.Star ); - // } - // } - //} - } - #endregion + // This is because the commented part is setting DockWidth of children....strange code. + return; + + //if (ActualWidth == 0.0 || + // ActualHeight == 0.0) + // return; + + //var modelAsPositionableElement = _model as ILayoutPositionableElementWithActualSize; + //if (_model.Orientation == Orientation.Horizontal) + //{ + // if (_model.ContainsChildOfType()) + // { + // for (int i = 0; i < _model.Children.Count; i++) + // { + // var childContainerModel = _model.Children[i] as ILayoutContainer; + // var childPositionableModel = _model.Children[i] as ILayoutPositionableElement; + + // if (childContainerModel != null && + // (childContainerModel.IsOfType() || + // childContainerModel.ContainsChildOfType())) + // { + // // childPositionableModel.DockWidth = new GridLength( 1.0, GridUnitType.Star ); + // } + // else if ((childPositionableModel != null) && childPositionableModel.DockWidth.IsStar) + // { + // var childPositionableModelWidthActualSize = childPositionableModel as ILayoutPositionableElementWithActualSize; + // if (childPositionableModelWidthActualSize.ActualWidth == 0d) + // continue; + + // var widthToSet = Math.Max(childPositionableModelWidthActualSize.ActualWidth, childPositionableModel.DockMinWidth); + + // widthToSet = Math.Min(widthToSet, ActualWidth / 2.0); + // widthToSet = Math.Max(widthToSet, childPositionableModel.DockMinWidth); + + // childPositionableModel.DockWidth = new GridLength(double.IsNaN(widthToSet) ? ActualWidth / 2.0 : widthToSet, GridUnitType.Pixel); + // } + // } + // } + // //else + // //{ + // // for( int i = 0; i < _model.Children.Count; i++ ) + // // { + // // var childPositionableModel = _model.Children[ i ] as ILayoutPositionableElement; + // // if( !childPositionableModel.DockWidth.IsStar ) + // // { + // // childPositionableModel.DockWidth = new GridLength( 1.0, GridUnitType.Star ); + // // } + // // } + // //} + //} + //else + //{ + // if (_model.ContainsChildOfType()) + // { + // for (int i = 0; i < _model.Children.Count; i++) + // { + // var childContainerModel = _model.Children[i] as ILayoutContainer; + // var childPositionableModel = _model.Children[i] as ILayoutPositionableElement; + + // if (childContainerModel != null && + // (childContainerModel.IsOfType() || + // childContainerModel.ContainsChildOfType())) + // { + // // childPositionableModel.DockHeight = new GridLength( 1.0, GridUnitType.Star ); + // } + // else if ((childPositionableModel != null) && childPositionableModel.DockHeight.IsStar) + // { + // var childPositionableModelWidthActualSize = childPositionableModel as ILayoutPositionableElementWithActualSize; + // if (childPositionableModelWidthActualSize.ActualHeight == 0d) + // continue; + + // var heightToSet = Math.Max(childPositionableModelWidthActualSize.ActualHeight, childPositionableModel.DockMinHeight); + // heightToSet = Math.Min(heightToSet, ActualHeight / 2.0); + // heightToSet = Math.Max(heightToSet, childPositionableModel.DockMinHeight); + + // childPositionableModel.DockHeight = new GridLength(double.IsNaN(heightToSet) ? ActualHeight / 2.0 : heightToSet, GridUnitType.Pixel); + // } + // } + // } + // //else + // //{ + // // for( int i = 0; i < _model.Children.Count; i++ ) + // // { + // // var childPositionableModel = _model.Children[ i ] as ILayoutPositionableElement; + // // if( !childPositionableModel.DockHeight.IsStar ) + // // { + // // childPositionableModel.DockHeight = new GridLength( 1.0, GridUnitType.Star ); + // // } + // // } + // //} + //} } #endregion diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/Shell/Standard/NativeMethods.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/Shell/Standard/NativeMethods.cs index 99da0dc6c..1a03eb714 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/Shell/Standard/NativeMethods.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/Shell/Standard/NativeMethods.cs @@ -1354,7 +1354,9 @@ internal enum WVR internal sealed class SafeFindHandle : SafeHandleZeroOrMinusOneIsInvalid { +#if !NETCORE && !NET5 [SecurityPermission( SecurityAction.LinkDemand, UnmanagedCode = true )] +#endif private SafeFindHandle() : base( true ) { } protected override bool ReleaseHandle() @@ -1404,7 +1406,9 @@ public IntPtr Hwnd private SafeDC() : base( true ) { } +#if !NETCORE && !NET5 [ReliabilityContract( Consistency.WillNotCorruptState, Cer.MayFail )] +#endif protected override bool ReleaseHandle() { if( _created ) @@ -1527,7 +1531,9 @@ internal sealed class SafeHBITMAP : SafeHandleZeroOrMinusOneIsInvalid { private SafeHBITMAP() : base( true ) { } +#if !NETCORE && !NET5 [ReliabilityContract( Consistency.WillNotCorruptState, Cer.MayFail )] +#endif protected override bool ReleaseHandle() { return NativeMethods.DeleteObject( handle ); @@ -1538,7 +1544,9 @@ internal sealed class SafeGdiplusStartupToken : SafeHandleZeroOrMinusOneIsInvali { private SafeGdiplusStartupToken() : base( true ) { } +#if !NETCORE && !NET5 [ReliabilityContract( Consistency.WillNotCorruptState, Cer.MayFail )] +#endif protected override bool ReleaseHandle() { Status s = NativeMethods.GdiplusShutdown( this.handle ); @@ -1607,7 +1615,9 @@ public void Disconnect() } [SuppressMessage( "Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes" )] +#if !NETCORE && !NET5 [ReliabilityContract( Consistency.WillNotCorruptState, Cer.MayFail )] +#endif protected override bool ReleaseHandle() { try @@ -1636,9 +1646,9 @@ protected override bool ReleaseHandle() } } - #endregion +#endregion - #region Native Types +#region Native Types [StructLayout( LayoutKind.Sequential )] internal struct BLENDFUNCTION @@ -1872,7 +1882,7 @@ public void Clear() Assert.IsTrue( hr.Succeeded ); } - #region IDisposable Pattern +#region IDisposable Pattern public void Dispose() { @@ -1891,7 +1901,7 @@ private void Dispose( bool disposing ) Clear(); } - #endregion +#endregion } [SuppressMessage( "Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses" )] @@ -2454,7 +2464,7 @@ internal struct DWM_TIMING_INFO public ulong cBuffersEmpty; } - #endregion +#endregion /// Delegate declaration that matches native WndProc signatures. internal delegate IntPtr WndProc( IntPtr hwnd, WM uMsg, IntPtr wParam, IntPtr lParam ); @@ -2830,7 +2840,9 @@ public static void DrawMenuBar( IntPtr hWnd ) [SuppressMessage( "Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode" )] [DllImport( "kernel32.dll" )] +#if !NETCORE && !NET5 [ReliabilityContract( Consistency.WillNotCorruptState, Cer.Success )] +#endif [return: MarshalAs( UnmanagedType.Bool )] public static extern bool FindClose( IntPtr handle ); @@ -2965,12 +2977,7 @@ public static MONITORINFO GetMonitorInfo( IntPtr hMonitor ) public static IntPtr GetStockObject( StockObject fnObject ) { - IntPtr retPtr = _GetStockObject( fnObject ); - if( retPtr == null ) - { - HRESULT.ThrowLastError(); - } - return retPtr; + return _GetStockObject( fnObject ); } [SuppressMessage( "Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode" )] @@ -3453,7 +3460,7 @@ public static void UpdateLayeredWindow( } } - #region Win7 declarations +#region Win7 declarations [DllImport( "shell32.dll", EntryPoint = "SHAddToRecentDocs" )] private static extern void _SHAddToRecentDocs_String( SHARD uFlags, [MarshalAs( UnmanagedType.LPWStr )] string pv ); @@ -3541,6 +3548,6 @@ public static void SHAddToRecentDocs( IShellLinkW shellLink ) [DllImport( "shell32.dll" )] public static extern HRESULT GetCurrentProcessExplicitAppUserModelID( [Out, MarshalAs( UnmanagedType.LPWStr )] out string AppID ); - #endregion +#endregion } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/Shell/Standard/Utilities.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/Shell/Standard/Utilities.cs index a34d32041..3320fb695 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/Shell/Standard/Utilities.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/Shell/Standard/Utilities.cs @@ -578,7 +578,9 @@ public static void SafeRelease( ref T comObject ) where T : class if( null != t ) { Assert.IsTrue( Marshal.IsComObject( t ) ); +#if !NETCORE && !NET5 Marshal.ReleaseComObject( t ); +#endif } } @@ -1005,7 +1007,7 @@ public static void RemoveDependencyPropertyChangeListener( object component, Dep dpd.RemoveValueChanged( component, listener ); } - #region Extension Methods +#region Extension Methods public static bool IsThicknessNonNegative( Thickness thickness ) { @@ -1067,6 +1069,6 @@ public static bool IsDoubleFiniteAndNonNegative( double d ) return true; } - #endregion +#endregion } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/DockingManager.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/DockingManager.cs index f98877341..a0e7a7959 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/DockingManager.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/DockingManager.cs @@ -3280,7 +3280,10 @@ private LayoutFloatingWindowControl CreateFloatingWindowForLayoutAnchorableWitho Left = fwLeft }; - + foreach( var layoutContent in destPane.Children ) + { + layoutContent.IsFloating = true; + } //fwc.Owner = Window.GetWindow(this); //fwc.SetParentToMainWindowOf(this); @@ -3384,6 +3387,7 @@ private LayoutFloatingWindowControl CreateFloatingWindowCore( LayoutContent cont }; } + contentModel.IsFloating = true; //fwc.Owner = Window.GetWindow(this); //fwc.SetParentToMainWindowOf(this); @@ -3433,9 +3437,9 @@ private void UpdateStarSize( LayoutContent contentModel ) if( grandParentPaneContainer != null ) { var children = grandParentPaneContainer.Children.Where( child => ( child.Equals( parentPane ) && ( parentPane is ILayoutContainer ) && ( ( ( ILayoutContainer )parentPane ).ChildrenCount > 1 ) ) - || !child.Equals( parentPane ) ) + || (!child.Equals( parentPane ) && (child is ILayoutContainer) && (((ILayoutContainer)child).ChildrenCount > 0)) ) .Cast() - .Where( child => child.DockHeight.IsStar ); + .Where( child => child.DockWidth.IsStar ); var childrenTotalWidth = children.Sum( child => child.DockWidth.Value ); foreach( var child in children ) { diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs index e614ecd71..6b7bf84ee 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutContent.cs @@ -162,7 +162,6 @@ public bool IsSelected parentSelector.SelectedContentIndex = _isSelected ? parentSelector.IndexOf( this ) : -1; OnIsSelectedChanged( oldValue, value ); RaisePropertyChanged( "IsSelected" ); - LayoutAnchorableTabItem.CancelMouseLeave(); } } } @@ -568,11 +567,22 @@ public object ToolTip #endregion #region IsFloating + + private bool _isFloating = false; + public bool IsFloating { get { - return this.FindParent() != null; + return _isFloating; + } + internal set + { + if( _isFloating != value ) + { + _isFloating = value; + RaisePropertyChanged( "IsFloating" ); + } } } @@ -750,6 +760,8 @@ public virtual void ReadXml( System.Xml.XmlReader reader ) FloatingWidth = double.Parse( reader.Value, CultureInfo.InvariantCulture ); if( reader.MoveToAttribute( "FloatingHeight" ) ) FloatingHeight = double.Parse( reader.Value, CultureInfo.InvariantCulture ); + if( reader.MoveToAttribute( "IsFloating" ) ) + IsFloating = bool.Parse( reader.Value ); if( reader.MoveToAttribute( "IsMaximized" ) ) IsMaximized = bool.Parse( reader.Value ); if( reader.MoveToAttribute( "CanClose" ) ) @@ -792,6 +804,8 @@ public virtual void WriteXml( System.Xml.XmlWriter writer ) writer.WriteAttributeString( "FloatingWidth", FloatingWidth.ToString( CultureInfo.InvariantCulture ) ); if( FloatingHeight != 0.0 ) writer.WriteAttributeString( "FloatingHeight", FloatingHeight.ToString( CultureInfo.InvariantCulture ) ); + if( IsFloating ) + writer.WriteAttributeString( "IsFloating", IsFloating.ToString() ); if( IsMaximized ) writer.WriteAttributeString( "IsMaximized", IsMaximized.ToString() ); // Always serialize CanClose because the default value is different for LayoutAnchorable vs LayoutDocument. diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Win32Helper.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Win32Helper.cs index f443c635d..93389b9b4 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Win32Helper.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Win32Helper.cs @@ -23,6 +23,7 @@ namespace Xceed.Wpf.AvalonDock { internal static class Win32Helper { +#pragma warning disable 618 [DllImport( "user32.dll", EntryPoint = "CreateWindowEx", CharSet = CharSet.Unicode )] internal static extern IntPtr CreateWindowEx( int dwExStyle, string lpszClassName, @@ -34,6 +35,7 @@ internal static extern IntPtr CreateWindowEx( int dwExStyle, IntPtr hMenu, IntPtr hInst, [MarshalAs( UnmanagedType.AsAny )] object pvParam ); +#pragma warning restore 618 internal const int WS_CHILD = 0x40000000, WS_VISIBLE = 0x10000000, diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.cs.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.cs.txt index 55921600c..f43e281f8 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.cs.txt +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/PropertyGridDefaultEditorsView.xaml.cs.txt @@ -49,6 +49,7 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views selectedObject.FontWeight = FontWeights.Bold; selectedObject.Guid = new Guid( "F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4" ); selectedObject.Char = 'T'; + selectedObject.Password = "This is my password"; selectedObject.Int16 = ( short )4; selectedObject.Int32 = (int)5; selectedObject.Int64 = (long)6; @@ -145,6 +146,9 @@ namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PropertyGrid.Views [Description( "This property uses a Char as the default editor." )] public Char Char { get; set; } [Category( "Non-Numeric Editors" )] + [PasswordPropertyText(true)] + public string Password { get; set; } + [Category( "Non-Numeric Editors" )] [Description( "This property uses a PrimitiveTypeCollectionEditor as the default editor." )] public List ListOfStrings { get; set; } [Category( "Non-Numeric Editors" )] diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Properties/AssemblyInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Properties/AssemblyInfo.cs index 3df8d1008..2d7552ad6 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Properties/AssemblyInfo.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Properties/AssemblyInfo.cs @@ -49,7 +49,7 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion( "4.1" )] +[assembly: AssemblyVersion( "4.2" )] #pragma warning disable 1699 [assembly: AssemblyDelaySign( false )] diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Samples/PropertyGrid/Views/PropertyGridDefaultEditorsView.xaml.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Samples/PropertyGrid/Views/PropertyGridDefaultEditorsView.xaml.cs index 55921600c..f43e281f8 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Samples/PropertyGrid/Views/PropertyGridDefaultEditorsView.xaml.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Samples/PropertyGrid/Views/PropertyGridDefaultEditorsView.xaml.cs @@ -49,6 +49,7 @@ public PropertyGridDefaultEditorsView() selectedObject.FontWeight = FontWeights.Bold; selectedObject.Guid = new Guid( "F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4" ); selectedObject.Char = 'T'; + selectedObject.Password = "This is my password"; selectedObject.Int16 = ( short )4; selectedObject.Int32 = (int)5; selectedObject.Int64 = (long)6; @@ -145,6 +146,9 @@ public decimal Decimal [Description( "This property uses a Char as the default editor." )] public Char Char { get; set; } [Category( "Non-Numeric Editors" )] + [PasswordPropertyText(true)] + public string Password { get; set; } + [Category( "Non-Numeric Editors" )] [Description( "This property uses a PrimitiveTypeCollectionEditor as the default editor." )] public List ListOfStrings { get; set; } [Category( "Non-Numeric Editors" )] diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs index e0b34f4a0..50efe3e90 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs @@ -22,7 +22,7 @@ COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at internal static class _XceedVersionInfo { [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] - public const string BaseVersion = "4.1"; + public const string BaseVersion = "4.2"; [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] public const string Version = BaseVersion + ".0.0"; diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Implementation/ButtonSpinner.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Implementation/ButtonSpinner.cs index 033a3bdd4..784c73427 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Implementation/ButtonSpinner.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Implementation/ButtonSpinner.cs @@ -19,6 +19,7 @@ COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Markup; +using System; namespace Xceed.Wpf.Toolkit { @@ -41,6 +42,8 @@ public class ButtonSpinner : Spinner #region Properties + #region Public Properties + #region AllowSpin public static readonly DependencyProperty AllowSpinProperty = DependencyProperty.Register( "AllowSpin", typeof( bool ), typeof( ButtonSpinner ), new UIPropertyMetadata( true, AllowSpinPropertyChanged ) ); @@ -64,9 +67,12 @@ private static void AllowSpinPropertyChanged( DependencyObject d, DependencyProp #endregion //AllowSpin + //[Obsolete( "ButtonSpinnerLocation is obsolete. Use SpinnerLocation instead." )] #region ButtonSpinnerLocation + [Obsolete( "ButtonSpinnerLocation is obsolete. Use SpinnerLocation instead." )] public static readonly DependencyProperty ButtonSpinnerLocationProperty = DependencyProperty.Register( "ButtonSpinnerLocation", typeof( Location ), typeof( ButtonSpinner ), new UIPropertyMetadata( Location.Right ) ); + [Obsolete( "ButtonSpinnerLocation is obsolete. Use SpinnerLocation instead." )] public Location ButtonSpinnerLocation { get @@ -81,6 +87,125 @@ public Location ButtonSpinnerLocation #endregion //ButtonSpinnerLocation + #region SpinnerLocation + + public static readonly DependencyProperty SpinnerLocationProperty = DependencyProperty.Register( "SpinnerLocation", typeof( Location ), typeof( ButtonSpinner ), new UIPropertyMetadata( Location.Right ) ); + public Location SpinnerLocation + { + get + { + return (Location)GetValue( SpinnerLocationProperty ); + } + set + { + SetValue( SpinnerLocationProperty, value ); + } + } + + #endregion //SpinnerLocation + + #region SpinnerWidth + + public static readonly DependencyProperty SpinnerWidthProperty = DependencyProperty.Register( "SpinnerWidth", typeof( double ), typeof( ButtonSpinner ), new UIPropertyMetadata( SystemParameters.VerticalScrollBarWidth ) ); + public double SpinnerWidth + { + get + { + return (double)GetValue( SpinnerWidthProperty ); + } + set + { + SetValue( SpinnerWidthProperty, value ); + } + } + + #endregion //SpinnerWidth + + #region SpinnerHeight + + public static readonly DependencyProperty SpinnerHeightProperty = DependencyProperty.Register( "SpinnerHeight", typeof( double ), typeof( ButtonSpinner ), new UIPropertyMetadata( double.NaN ) ); + public double SpinnerHeight + { + get + { + return (double)GetValue( SpinnerHeightProperty ); + } + set + { + SetValue( SpinnerHeightProperty, value ); + } + } + + #endregion //SpinnerHeight + + #region SpinnerDownContentTemplate + + public static readonly DependencyProperty SpinnerDownContentTemplateProperty = DependencyProperty.Register( "SpinnerDownContentTemplate", typeof( DataTemplate ), typeof( ButtonSpinner ), new UIPropertyMetadata( null ) ); + public DataTemplate SpinnerDownContentTemplate + { + get + { + return (DataTemplate)GetValue( SpinnerDownContentTemplateProperty ); + } + set + { + SetValue( SpinnerDownContentTemplateProperty, value ); + } + } + + #endregion //SpinnerDownContentTemplate + + #region SpinnerDownDisabledContentTemplate + + public static readonly DependencyProperty SpinnerDownDisabledContentTemplateProperty = DependencyProperty.Register( "SpinnerDownDisabledContentTemplate", typeof( DataTemplate ), typeof( ButtonSpinner ), new UIPropertyMetadata( null ) ); + public DataTemplate SpinnerDownDisabledContentTemplate + { + get + { + return (DataTemplate)GetValue( SpinnerDownDisabledContentTemplateProperty ); + } + set + { + SetValue( SpinnerDownDisabledContentTemplateProperty, value ); + } + } + + #endregion //SpinnerDownDisabledContentTemplate + + #region SpinnerUpContentTemplate + + public static readonly DependencyProperty SpinnerUpContentTemplateProperty = DependencyProperty.Register( "SpinnerUpContentTemplate", typeof( DataTemplate ), typeof( ButtonSpinner ), new UIPropertyMetadata( null ) ); + public DataTemplate SpinnerUpContentTemplate + { + get + { + return (DataTemplate)GetValue( SpinnerUpContentTemplateProperty ); + } + set + { + SetValue( SpinnerUpContentTemplateProperty, value ); + } + } + + #endregion //SpinnerUpContentTemplate + + #region SpinnerUpDisabledContentTemplate + + public static readonly DependencyProperty SpinnerUpDisabledContentTemplateProperty = DependencyProperty.Register( "SpinnerUpDisabledContentTemplate", typeof( DataTemplate ), typeof( ButtonSpinner ), new UIPropertyMetadata( null ) ); + public DataTemplate SpinnerUpDisabledContentTemplate + { + get + { + return (DataTemplate)GetValue( SpinnerUpDisabledContentTemplateProperty ); + } + set + { + SetValue( SpinnerUpDisabledContentTemplateProperty, value ); + } + } + + #endregion //SpinnerUpDisabledContentTemplate + #region Content /// @@ -112,6 +237,48 @@ private static void OnContentPropertyChanged( DependencyObject d, DependencyProp #endregion //Content + //[Obsolete( "ShowButtonSpinner is obsolete. Use ShowSpinner instead." )] + #region ShowButtonSpinner + + [Obsolete( "ShowButtonSpinner is obsolete. Use ShowSpinner instead." )] + public static readonly DependencyProperty ShowButtonSpinnerProperty = DependencyProperty.Register( "ShowButtonSpinner", typeof( bool ), typeof( ButtonSpinner ), new UIPropertyMetadata( true ) ); + [Obsolete( "ShowButtonSpinner is obsolete. Use ShowSpinner instead." )] + public bool ShowButtonSpinner + { + get + { + return ( bool )GetValue( ShowButtonSpinnerProperty ); + } + set + { + SetValue( ShowButtonSpinnerProperty, value ); + } + } + + #endregion //ShowButtonSpinner + + #region ShowSpinner + + public static readonly DependencyProperty ShowSpinnerProperty = DependencyProperty.Register( "ShowSpinner", typeof( bool ), typeof( ButtonSpinner ), new UIPropertyMetadata( true ) ); + + public bool ShowSpinner + { + get + { + return (bool)GetValue( ShowSpinnerProperty ); + } + set + { + SetValue( ShowSpinnerProperty, value ); + } + } + + #endregion //ShowSpinner + + #endregion //Properties + + #region Private Properties + #region DecreaseButton private ButtonBase _decreaseButton; @@ -172,24 +339,9 @@ private ButtonBase IncreaseButton #endregion //IncreaseButton - #region ShowButtonSpinner + #endregion - public static readonly DependencyProperty ShowButtonSpinnerProperty = DependencyProperty.Register( "ShowButtonSpinner", typeof( bool ), typeof( ButtonSpinner ), new UIPropertyMetadata( true ) ); - public bool ShowButtonSpinner - { - get - { - return ( bool )GetValue( ShowButtonSpinnerProperty ); - } - set - { - SetValue( ShowButtonSpinnerProperty, value ); - } - } - - #endregion //ShowButtonSpinner - - #endregion //Properties + #endregion #region Constructors diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Themes/Aero2.NormalColor.xaml index c931c6342..b381b3e55 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Themes/Aero2.NormalColor.xaml @@ -50,6 +50,14 @@ Value="1" /> + + + + @@ -72,9 +80,10 @@ SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> - + Width="{TemplateBinding SpinnerWidth}" + Height="{TemplateBinding SpinnerHeight}"> @@ -83,21 +92,21 @@ + ContentTemplate="{TemplateBinding SpinnerUpContentTemplate}"> + ContentTemplate="{TemplateBinding SpinnerDownContentTemplate}"> - + Value="{Binding SpinnerUpDisabledContentTemplate, RelativeSource={RelativeSource TemplatedParent}}" /> + Value="{Binding SpinnerDownDisabledContentTemplate, RelativeSource={RelativeSource TemplatedParent}}" /> - + + + + @@ -71,7 +79,8 @@ + Width="{TemplateBinding SpinnerWidth}" + Height="{TemplateBinding SpinnerHeight}"> @@ -80,21 +89,21 @@ + ContentTemplate="{TemplateBinding SpinnerUpContentTemplate}"> + ContentTemplate="{TemplateBinding SpinnerDownContentTemplate}" > - + Value="{Binding SpinnerUpDisabledContentTemplate, RelativeSource={RelativeSource TemplatedParent}}" /> - - + + - - - - - - - - - @@ -110,6 +90,18 @@ Value="Right" /> + + + + + + @@ -124,9 +116,15 @@ Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" - ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}" + SpinnerLocation="{TemplateBinding ButtonSpinnerLocation}" AllowSpin="{TemplateBinding AllowSpin}" - ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}" + ShowSpinner="{TemplateBinding ShowButtonSpinner}" + SpinnerWidth="{TemplateBinding ButtonSpinnerWidth}" + SpinnerHeight="{TemplateBinding ButtonSpinnerHeight}" + SpinnerUpContentTemplate="{TemplateBinding ButtonSpinnerUpContentTemplate}" + SpinnerDownContentTemplate="{TemplateBinding ButtonSpinnerDownContentTemplate}" + SpinnerUpDisabledContentTemplate="{TemplateBinding ButtonSpinnerUpDisabledContentTemplate}" + SpinnerDownDisabledContentTemplate="{TemplateBinding ButtonSpinnerDownDisabledContentTemplate}" VerticalContentAlignment="Stretch" HorizontalAlignment="Stretch"> + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CalculatorUpDown/Themes/Generic.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CalculatorUpDown/Themes/Generic.xaml index a8682c1a6..f5cd1cf02 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CalculatorUpDown/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CalculatorUpDown/Themes/Generic.xaml @@ -77,29 +77,9 @@ - - - - - - - - - @@ -133,8 +113,20 @@ Value="Right" /> + + + + + + @@ -148,9 +140,15 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" - ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}" + SpinnerLocation="{TemplateBinding ButtonSpinnerLocation}" AllowSpin="{TemplateBinding AllowSpin}" - ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}" + ShowSpinner="{TemplateBinding ShowButtonSpinner}" + SpinnerWidth="{TemplateBinding ButtonSpinnerWidth}" + SpinnerHeight="{TemplateBinding ButtonSpinnerHeight}" + SpinnerUpContentTemplate="{TemplateBinding ButtonSpinnerUpContentTemplate}" + SpinnerDownContentTemplate="{TemplateBinding ButtonSpinnerDownContentTemplate}" + SpinnerUpDisabledContentTemplate="{TemplateBinding ButtonSpinnerUpDisabledContentTemplate}" + SpinnerDownDisabledContentTemplate="{TemplateBinding ButtonSpinnerDownDisabledContentTemplate}" VerticalContentAlignment="Stretch" HorizontalAlignment="Stretch"> + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CollectionControl/Implementation/CollectionControlDialog.xaml.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CollectionControl/Implementation/CollectionControlDialog.xaml.cs index 557534551..3a3b2151d 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CollectionControl/Implementation/CollectionControlDialog.xaml.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CollectionControl/Implementation/CollectionControlDialog.xaml.cs @@ -204,13 +204,7 @@ private object Clone( object source ) if( source is Array ) { - using( var stream = new MemoryStream() ) - { - var formatter = new BinaryFormatter(); - formatter.Serialize( stream, source ); - stream.Seek( 0, SeekOrigin.Begin ); - result = ( Array )formatter.Deserialize( stream ); - } + result = (source as Array).Clone(); } // For IDictionary, we need to create EditableKeyValuePair to edit the Key-Value. else if( ( this.ItemsSource is IDictionary ) diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Aero2.NormalColor.xaml index 034eec6d3..0ec314ba1 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Aero2.NormalColor.xaml @@ -211,7 +211,7 @@ + Value="275" /> diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Generic.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Generic.xaml index da0b38ed7..505575704 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Generic.xaml @@ -251,7 +251,7 @@ + Value="275" /> diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Media/WindowColors.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Media/WindowColors.cs index 40f18a794..7014808f3 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Media/WindowColors.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Media/WindowColors.cs @@ -91,6 +91,7 @@ public static bool ColorizationOpaqueBlend private static int GetDWMIntValue( string keyName ) { +#pragma warning disable CA1416 // This value is not accessible throught the standard WPF API. // We must dig into the registry to get the value. var curUser = Microsoft.Win32.Registry.CurrentUser; @@ -100,9 +101,10 @@ private static int GetDWMIntValue( string keyName ) #if VS2008 ); #else - ,Microsoft.Win32.RegistryOptions.None ); + , Microsoft.Win32.RegistryOptions.None ); #endif - return ( int )subKey.GetValue( keyName ); + return (int)subKey.GetValue( keyName ); +#pragma warning restore CA1416 } private static Color GetDWMColorValue( string keyName ) diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/PackUriExtension.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/PackUriExtension.cs index c408b7561..09e0ed010 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/PackUriExtension.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/PackUriExtension.cs @@ -112,6 +112,7 @@ internal static string BuildRelativePackUriString( string assemblyName, string v + // If we have version information if( !String.IsNullOrEmpty( version ) ) { @@ -137,6 +138,7 @@ internal static string BuildAbsolutePackUriString( string assemblyName, string v + // If we have an assembly name and version information if( hasAssemblyName && !String.IsNullOrEmpty( version ) ) { diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Implementation/DateTimePicker.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Implementation/DateTimePicker.cs index 43e08e201..1232b8b47 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Implementation/DateTimePicker.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Implementation/DateTimePicker.cs @@ -23,6 +23,7 @@ COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at using Xceed.Wpf.Toolkit.Core.Utilities; using Xceed.Wpf.Toolkit.Primitives; using System.Windows.Shapes; +using System.Windows.Markup; #if VS2008 using Microsoft.Windows.Controls; using Microsoft.Windows.Controls.Primitives; @@ -258,6 +259,7 @@ public override void OnApplyTemplate() if( _calendar != null ) { + _calendar.Language = XmlLanguage.GetLanguage( System.Globalization.CultureInfo.CurrentCulture.IetfLanguageTag ); _calendar.SelectedDatesChanged += this.Calendar_SelectedDatesChanged; _calendar.MouseDoubleClick += this.Calendar_MouseDoubleClick; _calendar.SelectedDate = Value ?? null; diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Aero2.NormalColor.xaml index 01a523ed2..49a3926db 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Aero2.NormalColor.xaml @@ -62,29 +62,9 @@ - - - - - - - - - @@ -118,6 +98,18 @@ Value="{StaticResource DefaultWatermarkTemplate}" /> + + + + + + @@ -133,11 +125,17 @@ Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" - ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}" + SpinnerLocation="{TemplateBinding ButtonSpinnerLocation}" + SpinnerWidth="{TemplateBinding ButtonSpinnerWidth}" + SpinnerHeight="{TemplateBinding ButtonSpinnerHeight}" + SpinnerUpContentTemplate="{TemplateBinding ButtonSpinnerUpContentTemplate}" + SpinnerDownContentTemplate="{TemplateBinding ButtonSpinnerDownContentTemplate}" + SpinnerUpDisabledContentTemplate="{TemplateBinding ButtonSpinnerUpDisabledContentTemplate}" + SpinnerDownDisabledContentTemplate="{TemplateBinding ButtonSpinnerDownDisabledContentTemplate}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" AllowSpin="{TemplateBinding AllowSpin}" - ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}"> + ShowSpinner="{TemplateBinding ShowButtonSpinner}"> + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Generic.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Generic.xaml index deaec8138..291dfae8e 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Generic.xaml @@ -87,29 +87,9 @@ - - - - - - - - - @@ -142,6 +122,18 @@ Value="{StaticResource DefaultWatermarkTemplate}" /> + + + + + + @@ -157,11 +149,17 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" - ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}" + SpinnerLocation="{TemplateBinding ButtonSpinnerLocation}" + SpinnerWidth="{TemplateBinding ButtonSpinnerWidth}" + SpinnerHeight="{TemplateBinding ButtonSpinnerHeight}" + SpinnerUpContentTemplate="{TemplateBinding ButtonSpinnerUpContentTemplate}" + SpinnerDownContentTemplate="{TemplateBinding ButtonSpinnerDownContentTemplate}" + SpinnerUpDisabledContentTemplate="{TemplateBinding ButtonSpinnerUpDisabledContentTemplate}" + SpinnerDownDisabledContentTemplate="{TemplateBinding ButtonSpinnerDownDisabledContentTemplate}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" AllowSpin="{TemplateBinding AllowSpin}" - ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}"> + ShowSpinner="{TemplateBinding ShowButtonSpinner}"> + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimeUpDown/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimeUpDown/Themes/Aero2.NormalColor.xaml index 42ce984d2..b24047916 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimeUpDown/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimeUpDown/Themes/Aero2.NormalColor.xaml @@ -19,6 +19,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes" xmlns:local="clr-namespace:Xceed.Wpf.Toolkit"> + + + @@ -39,19 +42,33 @@ + + + + + IsTabStop="False" + Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + HorizontalContentAlignment="Stretch" + VerticalContentAlignment="Stretch" + SpinnerLocation="{TemplateBinding ButtonSpinnerLocation}" + SpinnerWidth="{TemplateBinding ButtonSpinnerWidth}" + SpinnerHeight="{TemplateBinding ButtonSpinnerHeight}" + SpinnerUpContentTemplate="{TemplateBinding ButtonSpinnerUpContentTemplate}" + SpinnerDownContentTemplate="{TemplateBinding ButtonSpinnerDownContentTemplate}" + SpinnerUpDisabledContentTemplate="{TemplateBinding ButtonSpinnerUpDisabledContentTemplate}" + SpinnerDownDisabledContentTemplate="{TemplateBinding ButtonSpinnerDownDisabledContentTemplate}" + AllowSpin="{TemplateBinding AllowSpin}" + ShowSpinner="{TemplateBinding ShowButtonSpinner}"> + + + - + + + + + @@ -61,10 +72,16 @@ BorderThickness="{TemplateBinding BorderThickness}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" - ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}" + SpinnerLocation="{TemplateBinding ButtonSpinnerLocation}" + SpinnerWidth="{TemplateBinding ButtonSpinnerWidth}" + SpinnerHeight="{TemplateBinding ButtonSpinnerHeight}" + SpinnerUpContentTemplate="{TemplateBinding ButtonSpinnerUpContentTemplate}" + SpinnerDownContentTemplate="{TemplateBinding ButtonSpinnerDownContentTemplate}" + SpinnerUpDisabledContentTemplate="{TemplateBinding ButtonSpinnerUpDisabledContentTemplate}" + SpinnerDownDisabledContentTemplate="{TemplateBinding ButtonSpinnerDownDisabledContentTemplate}" AllowSpin="{TemplateBinding AllowSpin}" - ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}"> - + 0 ) @@ -1421,10 +1439,10 @@ protected override void ValidateValue( object value ) } } - #endregion PROTECTED METHODS +#endregion PROTECTED METHODS - #region INTERNAL PROPERTIES +#region INTERNAL PROPERTIES internal bool IsForcingMask { @@ -1461,9 +1479,9 @@ internal override bool GetIsEditTextEmpty() return true; } - #endregion INTERNAL PROPERTIES +#endregion INTERNAL PROPERTIES - #region INTERNAL METHODS +#region INTERNAL METHODS internal override string GetCurrentText() { @@ -1577,9 +1595,9 @@ internal void ForceMask( string mask ) } } - #endregion INTERNAL METHODS +#endregion INTERNAL METHODS - #region PRIVATE PROPERTIES +#region PRIVATE PROPERTIES private bool IsOverwriteMode { @@ -1614,6 +1632,13 @@ private bool IsOverwriteMode #region PRIVATE METHODS + private void PlayBeep() + { +#pragma warning disable CA1416 + System.Media.SystemSounds.Beep.Play(); +#pragma warning restore CA1416 + } + private bool PlaceChar( char ch, int startPosition, int length, bool overwrite, out int caretIndex ) { return this.PlaceChar( m_maskedTextProvider, ch, startPosition, length, overwrite, out caretIndex ); @@ -1726,7 +1751,9 @@ internal void Replace( string text, int startPosition, int selectionLength ) else { if( this.BeepOnError ) - System.Media.SystemSounds.Beep.Play(); + { + this.PlayBeep(); + } } } @@ -1843,7 +1870,9 @@ private void Delete( int startPosition, int selectionLength, bool deleteForward if( !success ) { if( this.BeepOnError ) - System.Media.SystemSounds.Beep.Play(); + { + this.PlayBeep(); + } return; } @@ -1937,9 +1966,9 @@ private string GetSelectedText() return m_maskedTextProvider.ToString( true, includePrompt, includeLiterals, this.SelectionStart, selectionLength ); } - #endregion PRIVATE METHODS +#endregion PRIVATE METHODS - #region PRIVATE FIELDS +#region PRIVATE FIELDS private MaskedTextProvider m_maskedTextProvider; // = null; private bool m_insertToggled; // = false; @@ -1950,6 +1979,6 @@ private string GetSelectedText() private string m_formatSpecifier; private MethodInfo m_valueToStringMethodInfo; // = null; - #endregion PRIVATE FIELDS +#endregion PRIVATE FIELDS } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MessageBox/Implementation/MessageBox.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MessageBox/Implementation/MessageBox.cs index 85e128b1e..feeab261a 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MessageBox/Implementation/MessageBox.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MessageBox/Implementation/MessageBox.cs @@ -1190,7 +1190,9 @@ private void ExecuteCopy( object sender, ExecutedRoutedEventArgs e ) try { +#if !NETCORE && !NET5 new UIPermission( UIPermissionClipboard.AllClipboard ).Demand(); +#endif Clipboard.SetText( sb.ToString() ); } catch( SecurityException ) @@ -1199,6 +1201,6 @@ private void ExecuteCopy( object sender, ExecutedRoutedEventArgs e ) } } - #endregion COMMANDS +#endregion COMMANDS } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/NumericUpDown/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/NumericUpDown/Themes/Aero2.NormalColor.xaml index f26eae837..599fe0b6f 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/NumericUpDown/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/NumericUpDown/Themes/Aero2.NormalColor.xaml @@ -21,6 +21,9 @@ xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes" xmlns:prim="clr-namespace:Xceed.Wpf.Toolkit.Primitives" xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"> + + + @@ -62,8 +65,14 @@ HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" AllowSpin="{Binding AllowSpin, RelativeSource={RelativeSource TemplatedParent}}" - ShowButtonSpinner="{Binding ShowButtonSpinner, RelativeSource={RelativeSource TemplatedParent}}" - ButtonSpinnerLocation="{Binding ButtonSpinnerLocation, RelativeSource={RelativeSource TemplatedParent}}"> + ShowSpinner="{Binding ShowButtonSpinner, RelativeSource={RelativeSource TemplatedParent}}" + SpinnerLocation="{Binding ButtonSpinnerLocation, RelativeSource={RelativeSource TemplatedParent}}" + SpinnerWidth="{Binding ButtonSpinnerWidth, RelativeSource={RelativeSource TemplatedParent}}" + SpinnerHeight="{Binding ButtonSpinnerHeight, RelativeSource={RelativeSource TemplatedParent}}" + SpinnerUpContentTemplate="{Binding ButtonSpinnerUpContentTemplate, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={StaticResource IncreaseGlyphNormalKey}}" + SpinnerDownContentTemplate="{Binding ButtonSpinnerDownContentTemplate, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={StaticResource DecreaseGlyphNormalKey}}" + SpinnerUpDisabledContentTemplate="{Binding ButtonSpinnerUpDisabledContentTemplate, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={StaticResource IncreaseGlyphDisabledKey}}" + SpinnerDownDisabledContentTemplate="{Binding ButtonSpinnerDownDisabledContentTemplate, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={StaticResource DecreaseGlyphDisabledKey}}"> + + + @@ -62,8 +65,14 @@ HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" AllowSpin="{Binding AllowSpin, RelativeSource={RelativeSource TemplatedParent}}" - ShowButtonSpinner="{Binding ShowButtonSpinner, RelativeSource={RelativeSource TemplatedParent}}" - ButtonSpinnerLocation="{Binding ButtonSpinnerLocation, RelativeSource={RelativeSource TemplatedParent}}"> + ShowSpinner="{Binding ShowButtonSpinner, RelativeSource={RelativeSource TemplatedParent}}" + SpinnerLocation="{Binding ButtonSpinnerLocation, RelativeSource={RelativeSource TemplatedParent}}" + SpinnerWidth="{Binding ButtonSpinnerWidth, RelativeSource={RelativeSource TemplatedParent}}" + SpinnerHeight="{Binding ButtonSpinnerHeight, RelativeSource={RelativeSource TemplatedParent}}" + SpinnerUpContentTemplate="{Binding ButtonSpinnerUpContentTemplate, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={StaticResource IncreaseGlyphNormalKey}}" + SpinnerDownContentTemplate="{Binding ButtonSpinnerDownContentTemplate, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={StaticResource DecreaseGlyphNormalKey}}" + SpinnerUpDisabledContentTemplate="{Binding ButtonSpinnerUpDisabledContentTemplate, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={StaticResource IncreaseGlyphDisabledKey}}" + SpinnerDownDisabledContentTemplate="{Binding ButtonSpinnerDownDisabledContentTemplate, RelativeSource={RelativeSource TemplatedParent}, TargetNullValue={StaticResource DecreaseGlyphDisabledKey}}"> (this.SelectedItems as IEnumerable); + var items = this.ItemsCollection.Cast(); + // Have a faster selection when there are more than 200 items. - this.UpdateSelectedItemsWithoutNotifications( this.ItemsCollection.Cast().ToList() ); - // Raise SelectionChanged for every items. - foreach( var item in this.ItemsCollection ) + this.UpdateSelectedItemsWithoutNotifications( items.ToList() ); + + // Raise SelectionChanged for new selected items. + var newSelectedItems = items.Except( currentSelectedItems ); + foreach ( var item in newSelectedItems) { this.OnItemSelectionChanged( new ItemSelectionChangedEventArgs( Selector.ItemSelectionChangedEvent, this, item, true ) ); } @@ -125,7 +131,15 @@ public void SelectAll() public void UnSelectAll() { + var currentSelectedItems = new List( this.SelectedItems as IEnumerable ); + this.SelectedItems.Clear(); + + // Raise SelectionChanged for selected items. + foreach (var item in currentSelectedItems) + { + this.OnItemSelectionChanged( new ItemSelectionChangedEventArgs( Selector.ItemSelectionChangedEvent, this, item, false ) ); + } } #endregion diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Aero2/WindowControl.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Aero2/WindowControl.xaml index 6b0070066..6957981f5 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Aero2/WindowControl.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Aero2/WindowControl.xaml @@ -365,7 +365,7 @@ + Value="0" /> ), new UIPropertyMetadata( double.NaN ) ); + public double ButtonSpinnerHeight + { + get + { + return (double)GetValue( ButtonSpinnerHeightProperty ); + } + set + { + SetValue( ButtonSpinnerHeightProperty, value ); + } + } + + #endregion //ButtonSpinnerHeight + #region ButtonSpinnerLocation public static readonly DependencyProperty ButtonSpinnerLocationProperty = DependencyProperty.Register( "ButtonSpinnerLocation", typeof( Location @@ -104,6 +121,91 @@ public Location ButtonSpinnerLocation #endregion //ButtonSpinnerLocation + #region ButtonSpinnerDownContentTemplate + + public static readonly DependencyProperty ButtonSpinnerDownContentTemplateProperty = DependencyProperty.Register( "ButtonSpinnerDownContentTemplate", typeof( DataTemplate ), typeof( UpDownBase ), new UIPropertyMetadata( null ) ); + public DataTemplate ButtonSpinnerDownContentTemplate + { + get + { + return (DataTemplate)GetValue( ButtonSpinnerDownContentTemplateProperty ); + } + set + { + SetValue( ButtonSpinnerDownContentTemplateProperty, value ); + } + } + + #endregion //ButtonSpinnerDownContentTemplate + + #region ButtonSpinnerDownDisabledContentTemplate + + public static readonly DependencyProperty ButtonSpinnerDownDisabledContentTemplateProperty = DependencyProperty.Register( "ButtonSpinnerDownDisabledContentTemplate", typeof( DataTemplate ), typeof( UpDownBase ), new UIPropertyMetadata( null ) ); + public DataTemplate ButtonSpinnerDownDisabledContentTemplate + { + get + { + return (DataTemplate)GetValue( ButtonSpinnerDownDisabledContentTemplateProperty ); + } + set + { + SetValue( ButtonSpinnerDownDisabledContentTemplateProperty, value ); + } + } + + #endregion //ButtonSpinnerDownDisabledContentTemplate + + #region ButtonSpinnerUpContentTemplate + + public static readonly DependencyProperty ButtonSpinnerUpContentTemplateProperty = DependencyProperty.Register( "ButtonSpinnerUpContentTemplate", typeof( DataTemplate), typeof( UpDownBase ), new UIPropertyMetadata( null ) ); + public DataTemplate ButtonSpinnerUpContentTemplate + { + get + { + return (DataTemplate)GetValue( ButtonSpinnerUpContentTemplateProperty ); + } + set + { + SetValue( ButtonSpinnerUpContentTemplateProperty, value ); + } + } + + #endregion //ButtonSpinnerUpContentTemplate + + #region ButtonSpinnerUpDisabledContentTemplate + + public static readonly DependencyProperty ButtonSpinnerUpDisabledContentTemplateProperty = DependencyProperty.Register( "ButtonSpinnerUpDisabledContentTemplate", typeof( DataTemplate ), typeof( UpDownBase ), new UIPropertyMetadata( null ) ); + public DataTemplate ButtonSpinnerUpDisabledContentTemplate + { + get + { + return (DataTemplate)GetValue( ButtonSpinnerUpDisabledContentTemplateProperty ); + } + set + { + SetValue( ButtonSpinnerUpDisabledContentTemplateProperty, value ); + } + } + + #endregion //ButtonSpinnerUpDisabledContentTemplate + + #region ButtonSpinnerWidth + + public static readonly DependencyProperty ButtonSpinnerWidthProperty = DependencyProperty.Register( "ButtonSpinnerWidth", typeof( double ), typeof( UpDownBase ), new UIPropertyMetadata( SystemParameters.VerticalScrollBarWidth ) ); + public double ButtonSpinnerWidth + { + get + { + return (double)GetValue( ButtonSpinnerWidthProperty ); + } + set + { + SetValue( ButtonSpinnerWidthProperty, value ); + } + } + + #endregion //ButtonSpinnerWidth + #region ClipValueToMinMax public static readonly DependencyProperty ClipValueToMinMaxProperty = DependencyProperty.Register( "ClipValueToMinMax", typeof( bool ), typeof( diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/ValueRangeTextBox.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/ValueRangeTextBox.cs index 3544bcb9d..a7707c2f2 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/ValueRangeTextBox.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/ValueRangeTextBox.cs @@ -819,7 +819,7 @@ protected virtual bool QueryValueFromTextCore( string text, out object value ) { if( this.BeepOnError ) { - System.Media.SystemSounds.Beep.Play(); + this.PlayBeep(); } return false; } @@ -1075,7 +1075,7 @@ internal void RefreshValue() if( this.BeepOnError ) { - System.Media.SystemSounds.Beep.Play(); + this.PlayBeep(); } if( exception is ArgumentOutOfRangeException ) @@ -1114,6 +1114,13 @@ private static object ConvertValueToDataType( object value, Type type ) return value; } + private void PlayBeep() + { +#pragma warning disable CA1416 + System.Media.SystemSounds.Beep.Play(); +#pragma warning restore CA1416 + } + private void CanEnterLineBreak( object sender, CanExecuteRoutedEventArgs e ) { e.CanExecute = false; diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Properties/AssemblyInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Properties/AssemblyInfo.cs index 1186d2a27..15cf93cdf 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Properties/AssemblyInfo.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Properties/AssemblyInfo.cs @@ -56,6 +56,8 @@ COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at + + //In order to begin building localizable applications, set //CultureYouAreCodingWith in your .csproj file //inside a . For example, if you are using US english diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Converters/PropertyItemEditorConverter.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Converters/PropertyItemEditorConverter.cs index fc1bcc7e4..0425a6df0 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Converters/PropertyItemEditorConverter.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Converters/PropertyItemEditorConverter.cs @@ -80,8 +80,6 @@ private bool IsPropertySetLocally( object editor, DependencyProperty dp ) return false; var valueSource = DependencyPropertyHelper.GetValueSource( editorObject, dp ); - if( valueSource == null ) - return false; return ( valueSource.BaseValueSource == BaseValueSource.Local ); } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs index 8a940cbaf..b6d4f261f 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs @@ -237,6 +237,10 @@ internal override ITypeEditor CreateAttributeEditor() if( itemsSourceAttribute != null ) return new ItemsSourceAttributeEditor( itemsSourceAttribute ); + var passwordPropertyTextAttribute = GetAttribute(); + if( passwordPropertyTextAttribute != null ) + return new PasswordEditor(); + return null; } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/PasswordEditor.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/PasswordEditor.cs new file mode 100644 index 000000000..e8d96c7fa --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/PasswordEditor.cs @@ -0,0 +1,71 @@ +/************************************************************************************* + + Toolkit for WPF + + Copyright (C) 2007-2020 Xceed Software Inc. + + This program is provided to you under the terms of the XCEED SOFTWARE, INC. + COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at + https://github.com/xceedsoftware/wpftoolkit/blob/master/license.md + + For more features, controls, and fast professional support, + pick up the Plus Edition at https://xceed.com/xceed-toolkit-plus-for-wpf/ + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace Xceed.Wpf.Toolkit.PropertyGrid.Editors +{ + public class PasswordEditor : TypeEditor + { + protected override WatermarkPasswordBox CreateEditor() + { + return new PropertyGridEditorWatermarkPasswordBox(); + } + + protected override void SetValueDependencyProperty() + { + ValueProperty = WatermarkPasswordBox.TextProperty; + } + + protected override IValueConverter CreateValueConverter() + { + return new PasswordToStringConverter(this.Editor); + } + } + + public class PasswordToStringConverter : IValueConverter + { + private WatermarkPasswordBox _editor; + + public PasswordToStringConverter( WatermarkPasswordBox editor ) + { + _editor = editor; + } + + public object Convert( object value, Type targetType, object parameter, CultureInfo culture ) + { + _editor.Password = value as string; + return _editor.Text; + } + + public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture ) + { + return this._editor.Password; + } + } + + public class PropertyGridEditorWatermarkPasswordBox : WatermarkPasswordBox + { + static PropertyGridEditorWatermarkPasswordBox() + { + DefaultStyleKeyProperty.OverrideMetadata( typeof( PropertyGridEditorWatermarkPasswordBox ), new FrameworkPropertyMetadata( typeof( PropertyGridEditorWatermarkPasswordBox ) ) ); + } + } +} diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/TextBlockEditor.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/TextBlockEditor.cs index 3bf79fc32..b47ba60c8 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/TextBlockEditor.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/TextBlockEditor.cs @@ -17,11 +17,27 @@ COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at using System.Windows.Controls; using System.Windows; +using System.ComponentModel; +using System.Windows.Data; +using Xceed.Wpf.Toolkit.Core; +using System; +using System.Globalization; namespace Xceed.Wpf.Toolkit.PropertyGrid.Editors { public class TextBlockEditor : TypeEditor { + TypeConverter _typeConverter; + + public TextBlockEditor() + { + } + + public TextBlockEditor( TypeConverter typeConverter ) + { + _typeConverter = typeConverter; + } + protected override TextBlock CreateEditor() { return new PropertyGridEditorTextBlock(); @@ -31,8 +47,13 @@ protected override void SetValueDependencyProperty() { ValueProperty = TextBlock.TextProperty; } + } + + + + public class PropertyGridEditorTextBlock : TextBlock { static PropertyGridEditorTextBlock() diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs index a1a83d604..9cf1c4733 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs @@ -474,11 +474,13 @@ internal FrameworkElement GenerateChildrenEditorElement( PropertyItem propertyIt if( editorElement == null ) { - if( propertyItem.IsReadOnly - && !ListUtilities.IsListOfItems( propertyItem.PropertyType ) - && !ListUtilities.IsCollectionOfItems( propertyItem.PropertyType) + if( propertyItem.IsReadOnly + && !ListUtilities.IsListOfItems( propertyItem.PropertyType ) + && !ListUtilities.IsCollectionOfItems( propertyItem.PropertyType ) && !ListUtilities.IsDictionaryOfItems( propertyItem.PropertyType ) ) - editor = new TextBlockEditor(); + { + editor = new TextBlockEditor( (propertyItem.PropertyDescriptor != null) ? propertyItem.PropertyDescriptor.Converter : null ); + } // Fallback: Use a default type editor. if( editor == null ) diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyItem.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyItem.cs index d962306d9..4db14eb55 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyItem.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyItem.cs @@ -227,16 +227,15 @@ internal void SetRedInvalidBorder( BindingExpression be ) { if( (be != null) && be.DataItem is DescriptorPropertyDefinitionBase ) { - DescriptorPropertyDefinitionBase descriptor = be.DataItem as DescriptorPropertyDefinitionBase; - if( Validation.GetHasError( descriptor ) ) + this.Dispatcher.BeginInvoke( DispatcherPriority.Input, new Action( () => { - this.Dispatcher.BeginInvoke( DispatcherPriority.Input, new Action( () => + DescriptorPropertyDefinitionBase descriptor = be.DataItem as DescriptorPropertyDefinitionBase; + if( ( descriptor != null) && Validation.GetHasError( descriptor ) ) { - var errors = Validation.GetErrors( descriptor ); - Validation.MarkInvalid( be, errors[ 0 ] ); + var errors = Validation.GetErrors( descriptor ); + Validation.MarkInvalid( be, errors[0] ); } - ) ); - } + } ) ); } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml index a3fc39581..fa7436f7c 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml @@ -306,6 +306,13 @@ Value="0" /> + + + + + +