diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/AssemblyVersionInfo.cs index 243365ac..84bce886 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/AssemblyVersionInfo.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Aero/AssemblyVersionInfo.cs @@ -21,7 +21,7 @@ internal static class _XceedVersionInfo { [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] - public const string BaseVersion = "2.8"; + public const string BaseVersion = "2.9"; [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] public const string Version = BaseVersion + ".0.0"; diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/AssemblyVersionInfo.cs index 243365ac..84bce886 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/AssemblyVersionInfo.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.Metro/AssemblyVersionInfo.cs @@ -21,7 +21,7 @@ internal static class _XceedVersionInfo { [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] - public const string BaseVersion = "2.8"; + public const string BaseVersion = "2.9"; [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] public const string Version = BaseVersion + ".0.0"; diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/AssemblyVersionInfo.cs index 243365ac..84bce886 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/AssemblyVersionInfo.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock.Themes.VS2010/AssemblyVersionInfo.cs @@ -21,7 +21,7 @@ internal static class _XceedVersionInfo { [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] - public const string BaseVersion = "2.8"; + public const string BaseVersion = "2.9"; [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] public const string Version = BaseVersion + ".0.0"; diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/AssemblyVersionInfo.cs index 243365ac..84bce886 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/AssemblyVersionInfo.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/AssemblyVersionInfo.cs @@ -21,7 +21,7 @@ internal static class _XceedVersionInfo { [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] - public const string BaseVersion = "2.8"; + public const string BaseVersion = "2.9"; [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] public const string Version = BaseVersion + ".0.0"; diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/DockingManager.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/DockingManager.cs index 749d3c57..68e139ab 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/DockingManager.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/DockingManager.cs @@ -163,7 +163,7 @@ namespace Xceed.Wpf.AvalonDock CommandManager.InvalidateRequerySuggested(); } - DispatcherOperation _setFocusAsyncOperation = null; + // DispatcherOperation _setFocusAsyncOperation = null; void OnLayoutRootPropertyChanged(object sender, PropertyChangedEventArgs e) { @@ -194,10 +194,14 @@ namespace Xceed.Wpf.AvalonDock //} } - if (!_insideInternalSetActiveContent) - ActiveContent = Layout.ActiveContent != null ? - Layout.ActiveContent.Content : null; + //if (!_insideInternalSetActiveContent) + // ActiveContent = Layout.ActiveContent != null ? + // Layout.ActiveContent.Content : null; + if( !_insideInternalSetActiveContent && (Layout.ActiveContent != null) ) + { + this.ActiveContent = Layout.ActiveContent.Content; } + } } void OnLayoutRootUpdated(object sender, EventArgs e) @@ -267,7 +271,7 @@ namespace Xceed.Wpf.AvalonDock { base.OnApplyTemplate(); - SetupAutoHideWindow(); + // SetupAutoHideWindow(); } protected override void OnInitialized( EventArgs e ) @@ -288,6 +292,8 @@ namespace Xceed.Wpf.AvalonDock BottomSidePanel = CreateUIElementForModel( Layout.BottomSide ) as LayoutAnchorSideControl; } + SetupAutoHideWindow(); + //load windows not already loaded! foreach (var fw in Layout.FloatingWindows.Where(fw => !_fwList.Any(fwc => fwc.Model == fw))) _fwList.Add(CreateUIElementForModel(fw) as LayoutFloatingWindowControl); diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutGroup.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutGroup.cs index 1ff57128..9af005bc 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutGroup.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Layout/LayoutGroup.cs @@ -200,11 +200,16 @@ namespace Xceed.Wpf.AvalonDock.Layout reader.Read(); while (true) { - if (reader.LocalName == localName && - reader.NodeType == System.Xml.XmlNodeType.EndElement) + if ( (reader.LocalName == localName ) && + ( reader.NodeType == System.Xml.XmlNodeType.EndElement) ) { break; } + if( reader.NodeType == System.Xml.XmlNodeType.Whitespace ) + { + reader.Read(); + continue; + } XmlSerializer serializer = null; if (reader.LocalName == "LayoutAnchorablePaneGroup") @@ -223,6 +228,13 @@ namespace Xceed.Wpf.AvalonDock.Layout serializer = new XmlSerializer(typeof(LayoutAnchorGroup)); else if (reader.LocalName == "LayoutPanel") serializer = new XmlSerializer(typeof(LayoutPanel)); + else + { + Type type = this.FindType( reader.LocalName ); + if( type == null ) + throw new ArgumentException( "AvalonDock.LayoutGroup doesn't know how to deserialize " + reader.LocalName ); + serializer = new XmlSerializer( type ); + } Children.Add((T)serializer.Deserialize(reader)); } @@ -240,5 +252,18 @@ namespace Xceed.Wpf.AvalonDock.Layout } } + + private Type FindType( string name ) + { + foreach( var a in AppDomain.CurrentDomain.GetAssemblies() ) + { + foreach( var t in a.GetTypes() ) + { + if( t.Name.Equals( name ) ) + return t; + } + } + return null; + } } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Themes/generic.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Themes/generic.xaml index e62b3f31..07bd42fa 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Themes/generic.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Themes/generic.xaml @@ -840,7 +840,7 @@ CaptionHeight="16" CornerRadius="3,3,3,3" GlassFrameThickness="0" - ShowSystemMenu="True"/> + ShowSystemMenu="False"/> diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.DataGrid/(CollectionView)/DataGridCollectionView.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.DataGrid/(CollectionView)/DataGridCollectionView.cs index 888bfa68..642346d9 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.DataGrid/(CollectionView)/DataGridCollectionView.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.DataGrid/(CollectionView)/DataGridCollectionView.cs @@ -22,6 +22,7 @@ using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics; using System.Globalization; +using System.Linq; using System.Threading; using System.Windows.Data; using Xceed.Utils.Collections; @@ -972,44 +973,29 @@ namespace Xceed.Wpf.DataGrid m_lastAddCount = newSourceItemCount; m_lastAddIndex = startIndex; - int count = items.Count; - List filteredItems = new List( count ); - RawItem[] rawItems = new RawItem[ count ]; + var filteredItemsChanged = false; - for( int i = 0; i < count; i++ ) + for( int i = 0; i < items.Count; i++ ) { - object item = items[ i ]; - RawItem rawItem = new RawItem( startIndex + i, item ); - rawItems[ i ] = rawItem; + var index = startIndex + i; + var item = items[ i ]; + var rawItem = new RawItem( index, item ); - if( this.PassesFilter( rawItem.DataItem ) - && this.PassesAutoFilter( rawItem.DataItem, null ) - && this.PassesFilterCriterion( rawItem.DataItem ) ) + if( this.PassesFilter( item ) && this.PassesAutoFilter( item, null ) && this.PassesFilterCriterion( item ) ) { - filteredItems.Add( rawItem ); - } - } - - bool isLast = ( startIndex == this.SourceItemCount ); - this.AddRawItemInSourceList( startIndex, rawItems ); + filteredItemsChanged = true; - if( filteredItems.Count != 0 ) - { - this.AddRawItemInFilteredList( filteredItems, isLast ); - this.AddRawItemInGroup( filteredItems ); - - if( m_statFunctions.Count > 0 ) + this.AddRawItemInSourceList( index, rawItem ); + this.AddRawItemInFilteredList( rawItem ); + this.AddRawItemInGroup( rawItem ); + } + else { - DeferredOperationManager deferredOperationManager = this.DeferredOperationManager; - foreach( RawItem rawItem in filteredItems ) - { - //When adding a new item, make sure all stats for the specified group are recalculated even if UpdateChangedPropertyStatsOnly is set to true - deferredOperationManager.InvalidateGroupStats( rawItem.ParentGroup, true ); - } + this.AddRawItemInSourceList( index, rawItem ); } } - this.RefreshDistinctValues( filteredItems.Count > 0 ); + this.RefreshDistinctValues( filteredItemsChanged ); return true; } @@ -1023,38 +1009,31 @@ namespace Xceed.Wpf.DataGrid return false; } - RawItem rawItem; - RawItem[] removedItems = new RawItem[ count ]; + var filteredItemsChanged = false; for( int i = 0; i < count; i++ ) { - rawItem = m_sourceItemList[ i + startIndex ]; + var rawItem = m_sourceItemList[ startIndex ]; if( this.CurrentEditItem == rawItem.DataItem ) { this.SetCurrentEditItem( null ); } - removedItems[ i ] = rawItem; + if( this.RemoveRawItemInFilteredList( rawItem ) ) + { + filteredItemsChanged = true; - //When removing an item, make sure all stats for the specified group are recalculated even if UpdateChangedPropertyStatsOnly is set to true - if( m_statFunctions.Count > 0 ) + this.RemoveRawItemInSourceList( startIndex ); + this.RemoveRawItemInGroup( rawItem ); + } + else { - this.DeferredOperationManager.InvalidateGroupStats( rawItem.ParentGroup, true ); + this.RemoveRawItemInSourceList( startIndex ); } } - int filteredItemRemovedCount = this.RemoveRawItemInFilteredList( removedItems ); - - // We do the raw item list after cleaning up the filtered list to delay the resequencing of the RawItem. - this.RemoveRawItemInSourceList( startIndex, count ); - - if( filteredItemRemovedCount > 0 ) - { - this.RemoveRawItemInGroup( removedItems ); - } - - this.RefreshDistinctValues( filteredItemRemovedCount > 0 ); + this.RefreshDistinctValues( filteredItemsChanged ); return true; } @@ -1313,17 +1292,14 @@ namespace Xceed.Wpf.DataGrid { Debug.Assert( rawItem.GetGlobalSortedIndex() == globalSortedIndex ); - object dataItem = rawItem.DataItem; + var dataItem = rawItem.DataItem; - if( this.PassesFilter( dataItem ) - && this.PassesAutoFilter( dataItem, null ) - && this.PassesFilterCriterion( dataItem ) ) + if( this.PassesFilter( dataItem ) && this.PassesAutoFilter( dataItem, null ) && this.PassesFilterCriterion( dataItem ) ) { if( globalSortedIndex == -1 ) { - RawItem[] rawItems = new RawItem[] { rawItem }; - this.AddRawItemInFilteredList( rawItems, false ); - this.AddRawItemInGroup( rawItems ); + this.AddRawItemInFilteredList( rawItem ); + this.AddRawItemInGroup( rawItem ); this.RefreshDistinctValues( true ); return; @@ -1337,9 +1313,8 @@ namespace Xceed.Wpf.DataGrid { if( globalSortedIndex != -1 ) { - RawItem[] rawItems = new RawItem[] { rawItem }; - this.RemoveRawItemInFilteredList( rawItems ); - this.RemoveRawItemInGroup( rawItems ); + this.RemoveRawItemInFilteredList( rawItem ); + this.RemoveRawItemInGroup( rawItem ); } this.RefreshDistinctValues( true ); @@ -1347,8 +1322,8 @@ namespace Xceed.Wpf.DataGrid } // Verify the row is in the correct group. - DataGridCollectionViewGroup newGroup = this.GetRawItemNewGroup( rawItem ); - DataGridCollectionViewGroup currentGroup = rawItem.ParentGroup; + var newGroup = this.GetRawItemNewGroup( rawItem ); + var currentGroup = rawItem.ParentGroup; if( currentGroup != newGroup ) { @@ -1356,14 +1331,14 @@ namespace Xceed.Wpf.DataGrid { if( m_statFunctions.Count > 0 ) { - DeferredOperationManager deferredOperationManager = this.DeferredOperationManager; + var deferredOperationManager = this.DeferredOperationManager; //If an item is moved from one group to another, make sure all stats for the specified groups are recalculated even if UpdateChangedPropertyStatsOnly is set to true deferredOperationManager.InvalidateGroupStats( currentGroup, true ); deferredOperationManager.InvalidateGroupStats( newGroup, true ); } - int newSortIndex = newGroup.BinarySearchRawItem( rawItem, this.RawItemSortComparer ); + var newSortIndex = newGroup.BinarySearchRawItem( rawItem, this.RawItemSortComparer ); if( newSortIndex < 0 ) { @@ -1372,7 +1347,7 @@ namespace Xceed.Wpf.DataGrid currentGroup.RemoveRawItemAt( rawItem.SortedIndex ); newGroup.InsertRawItem( newSortIndex, rawItem ); - int newGlobalSortedIndex = rawItem.GetGlobalSortedIndex(); + var newGlobalSortedIndex = rawItem.GetGlobalSortedIndex(); this.AdjustCurrencyAfterMove( globalSortedIndex, newGlobalSortedIndex, 1 ); this.OnCollectionChanged( new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Move, rawItem.DataItem, newGlobalSortedIndex, globalSortedIndex ) ); } @@ -1403,7 +1378,7 @@ namespace Xceed.Wpf.DataGrid using( this.DeferCurrencyEvent() ) { newGroup.MoveRawItem( rawItem.SortedIndex, newSortIndex ); - int newGlobalSortedIndex = rawItem.GetGlobalSortedIndex(); + var newGlobalSortedIndex = rawItem.GetGlobalSortedIndex(); this.AdjustCurrencyAfterMove( globalSortedIndex, newGlobalSortedIndex, 1 ); this.OnCollectionChanged( new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Move, rawItem.DataItem, newGlobalSortedIndex, globalSortedIndex ) ); } @@ -1680,7 +1655,7 @@ namespace Xceed.Wpf.DataGrid private bool MoveSourceItem( int oldStartIndex, IList items, int newStartIndex ) { - int count = items.Count; + var count = items.Count; if( ( oldStartIndex < 0 ) || ( oldStartIndex + count > m_sourceItemList.Count ) || ( newStartIndex < 0 ) || ( newStartIndex > ( m_sourceItemList.Count - count ) ) ) { @@ -1688,47 +1663,60 @@ namespace Xceed.Wpf.DataGrid return false; } - m_lastAddCount = -1; - RawItem[] rawItems = new RawItem[ count ]; - List filteredRawItems = new List( count ); - - for( int i = 0; i < count; i++ ) + if( oldStartIndex < newStartIndex ) { - RawItem rawItem = m_sourceItemList[ oldStartIndex + i ]; - rawItems[ i ] = rawItem; - - // If our parent group is null, we are filtered out. - if( rawItem.ParentGroup != null ) + for( int i = count - 1; i >= 0; i-- ) { - filteredRawItems.Add( rawItem ); - } - } + var oldIndex = oldStartIndex + i; + var newIndex = newStartIndex + i; - int filteredItemCount = this.RemoveRawItemInFilteredList( rawItems ); + Debug.Assert( (oldIndex >= 0) && (oldIndex < m_sourceItemList.Count) ); + Debug.Assert( (newIndex >= 0) && (newIndex < m_sourceItemList.Count) ); - Debug.Assert( filteredItemCount == filteredRawItems.Count ); + var rawItem = m_sourceItemList[ oldIndex ]; + var wasFiltered = this.RemoveRawItemInFilteredList( rawItem ); - m_sourceItemList.RemoveRange( oldStartIndex, count ); - m_sourceItemList.InsertRange( newStartIndex, rawItems ); + m_sourceItemList.RemoveAt( oldIndex ); + m_sourceItemList.Insert( newIndex, rawItem ); - int startIndex = Math.Min( oldStartIndex, newStartIndex ); - int endIndex = Math.Max( oldStartIndex, newStartIndex ) + count; + for( int j = oldIndex; j <= newIndex; j++ ) + { + m_sourceItemList[ j ].SetIndex( j ); + } - for( int i = startIndex; i < endIndex; i++ ) - { - m_sourceItemList[ i ].SetIndex( i ); + if( wasFiltered ) + { + this.AddRawItemInFilteredList( rawItem ); + this.EnsurePosition( rawItem, rawItem.GetGlobalSortedIndex() ); + } + } } + else if( oldStartIndex > newStartIndex ) + { + for( int i = 0; i < count; i++ ) + { + var oldIndex = oldStartIndex + i; + var newIndex = newStartIndex + i; - filteredItemCount = filteredRawItems.Count; + Debug.Assert( (oldIndex >= 0) && (oldIndex < m_sourceItemList.Count) ); + Debug.Assert( (newIndex >= 0) && (newIndex < m_sourceItemList.Count) ); - if( filteredItemCount > 0 ) - { - this.AddRawItemInFilteredList( filteredRawItems, false ); + var rawItem = m_sourceItemList[ oldIndex ]; + var wasFiltered = this.RemoveRawItemInFilteredList( rawItem ); - for( int i = 0; i < filteredItemCount; i++ ) - { - RawItem rawItem = filteredRawItems[ i ]; - this.EnsurePosition( rawItem, rawItem.GetGlobalSortedIndex() ); + m_sourceItemList.RemoveAt( oldIndex ); + m_sourceItemList.Insert( newIndex, rawItem ); + + for( int j = newIndex; j <= oldIndex; j++ ) + { + m_sourceItemList[ j ].SetIndex( j ); + } + + if( wasFiltered ) + { + this.AddRawItemInFilteredList( rawItem ); + this.EnsurePosition( rawItem, rawItem.GetGlobalSortedIndex() ); + } } } @@ -1737,7 +1725,7 @@ namespace Xceed.Wpf.DataGrid private bool ResetSourceItem( object dataItem ) { - RawItem rawItem = null; + var rawItem = default( RawItem ); //Verify if the item is in the same detail CollectionView as the previous item was found in. if( m_currentChildCollectionView != null ) @@ -1760,23 +1748,22 @@ namespace Xceed.Wpf.DataGrid //If the item was found, refresh it. if( rawItem != null ) { - int globalSortedIndex = rawItem.GetGlobalSortedIndex(); - this.EnsurePosition( rawItem, globalSortedIndex ); + this.EnsurePosition( rawItem, rawItem.GetGlobalSortedIndex() ); return true; } //If the item was not found, look for it in an expended detail. - foreach( DataGridContext detailContext in this.DataGridContext.GetChildContextsCore() ) + foreach( var detailContext in this.DataGridContext.GetChildContextsCore() ) { - DataGridCollectionView detailCollectionView = detailContext.Items as DataGridCollectionView; - if( detailCollectionView != null ) + var detailCollectionView = detailContext.Items as DataGridCollectionView; + if( detailCollectionView == null ) + continue; + + if( detailCollectionView.ResetSourceItem( dataItem ) ) { - if( detailCollectionView.ResetSourceItem( dataItem ) ) - { - //keep a reference to the detail CollectionView the item was found in, in case following items belong to the same detail. - m_currentChildCollectionView = detailCollectionView; - return true; - } + //keep a reference to the detail CollectionView the item was found in, in case following items belong to the same detail. + m_currentChildCollectionView = detailCollectionView; + return true; } } @@ -1791,38 +1778,34 @@ namespace Xceed.Wpf.DataGrid } } - private void AddRawItemInSourceList( int startIndex, IList rawItems ) + private void AddRawItemInSourceList( int index, RawItem rawItem ) { - m_sourceItemList.InsertRange( startIndex, rawItems ); + Debug.Assert( (index >= 0) && (index <= m_sourceItemList.Count) ); + Debug.Assert( rawItem != null ); - foreach( RawItem rawItem in rawItems ) - { - this.AddRawItemDataItemMapping( rawItem ); - } + m_sourceItemList.Insert( index, rawItem ); - int count = m_sourceItemList.Count; + this.AddRawItemDataItemMapping( rawItem ); - for( int i = startIndex + rawItems.Count; i < count; i++ ) + for( var i = m_sourceItemList.Count - 1; i > index; i-- ) { m_sourceItemList[ i ].SetIndex( i ); } } - private void AddRawItemInFilteredList( IList rawItems, bool isLast ) + private void AddRawItemInFilteredList( RawItem rawItem ) { + Debug.Assert( rawItem != null ); + // The function take for granted that all RawItem's index are sequential, // or if there is gap, the index contained in the gap are not already contained in the list. - - int index; - - if( isLast ) + if( (m_filteredItemList.Count == 0) || (m_filteredItemList.Last().Index < rawItem.Index) ) { - index = m_filteredItemList.Count; + m_filteredItemList.Add( rawItem ); } else { - index = m_filteredItemList.BinarySearch( rawItems[ 0 ], DataGridCollectionView.RawItemIndexComparer ); - + var index = m_filteredItemList.BinarySearch( rawItem, DataGridCollectionView.RawItemIndexComparer ); Debug.Assert( index < 0 ); if( index < 0 ) @@ -1830,35 +1813,25 @@ namespace Xceed.Wpf.DataGrid index = ~index; } - Debug.Assert( index <= m_filteredItemList.Count ); - } - - m_filteredItemList.InsertRange( index, rawItems ); - } - - private void AddRawItemInGroup( IList rawItems ) - { - int count = rawItems.Count; - - for( int i = 0; i < count; i++ ) - { - this.AddRawItemInGroup( rawItems[ i ] ); + m_filteredItemList.Insert( index, rawItem ); } } private void AddRawItemInGroup( RawItem rawItem ) { + Debug.Assert( rawItem != null ); + using( this.DeferCurrencyEvent() ) { - DataGridCollectionViewGroup newGroup = this.GetRawItemNewGroup( rawItem ); - int index = newGroup.BinarySearchRawItem( rawItem, this.RawItemSortComparer ); + var newGroup = this.GetRawItemNewGroup( rawItem ); + var index = newGroup.BinarySearchRawItem( rawItem, this.RawItemSortComparer ); if( index < 0 ) { index = ~index; } - int globalIndex = newGroup.GetFirstRawItemGlobalSortedIndex() + index; + var globalIndex = newGroup.GetFirstRawItemGlobalSortedIndex() + index; this.AdjustCurrencyBeforeAdd( globalIndex ); newGroup.InsertRawItem( index, rawItem ); @@ -1869,89 +1842,74 @@ namespace Xceed.Wpf.DataGrid this.OnCollectionChanged( new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Add, rawItem.DataItem, globalIndex ) ); } - } - private void RemoveRawItemInSourceList( int startIndex, int count ) - { - int endIndex = startIndex + count - 1; - for( int i = startIndex; i <= endIndex; i++ ) + //When adding an item, make sure all stats for the specified group are recalculated even if UpdateChangedPropertyStatsOnly is set to true + if( m_statFunctions.Count > 0 ) { - this.RemoveRawItemDataItemMapping( m_sourceItemList[ i ] ); + this.DeferredOperationManager.InvalidateGroupStats( rawItem.ParentGroup, true ); } + } + + private void RemoveRawItemInSourceList( int index ) + { + Debug.Assert( (index >= 0) && (index < m_sourceItemList.Count) ); + + this.RemoveRawItemDataItemMapping( m_sourceItemList[ index ] ); - m_sourceItemList.RemoveRange( startIndex, count ); - int totalCount = m_sourceItemList.Count; + m_sourceItemList.RemoveAt( index ); - for( int i = startIndex; i < totalCount; i++ ) + for( int i = m_sourceItemList.Count - 1; i >= index; i-- ) { m_sourceItemList[ i ].SetIndex( i ); } } - private int RemoveRawItemInFilteredList( IList rawItems ) + private bool RemoveRawItemInFilteredList( RawItem rawItem ) { + Debug.Assert( rawItem != null ); + // The function take for granted that all RawItem's index are sequential, // There should not be any gap in the index sequence. - - int index = m_filteredItemList.BinarySearch( rawItems[ 0 ], DataGridCollectionView.RawItemIndexComparer ); - + var index = m_filteredItemList.BinarySearch( rawItem, DataGridCollectionView.RawItemIndexComparer ); if( index < 0 ) - { - index = ~index; - } - - if( index > m_filteredItemList.Count ) - return 0; - - int lastRawItemIndex = rawItems[ rawItems.Count - 1 ].Index; - - int count = m_filteredItemList.Count; - int countToRemove = 0; + return false; - for( int i = index; i < count; i++ ) - { - if( m_filteredItemList[ i ].Index <= lastRawItemIndex ) - { - countToRemove++; - } - } + Debug.Assert( (index >= 0) && (index < m_filteredItemList.Count) ); - if( countToRemove > 0 ) - { - m_filteredItemList.RemoveRange( index, countToRemove ); - } + m_filteredItemList.RemoveAt( index ); - return countToRemove; + return true; } - private void RemoveRawItemInGroup( IList rawItems ) + private void RemoveRawItemInGroup( RawItem rawItem ) { - int count = rawItems.Count; + Debug.Assert( rawItem != null ); - for( int i = 0; i < count; i++ ) + var parentGroup = rawItem.ParentGroup; + if( parentGroup == null ) + return; + + var globalSortedIndex = rawItem.GetGlobalSortedIndex(); + + using( this.DeferCurrencyEvent() ) { - RawItem oldRawItem = rawItems[ i ]; - DataGridCollectionViewGroup parentGroup = oldRawItem.ParentGroup; + this.AdjustCurrencyBeforeRemove( globalSortedIndex ); + parentGroup.RemoveRawItemAt( rawItem.SortedIndex ); - if( parentGroup != null ) + unchecked { - int globalSortedIndex = oldRawItem.GetGlobalSortedIndex(); - - using( this.DeferCurrencyEvent() ) - { - this.AdjustCurrencyBeforeRemove( globalSortedIndex ); - parentGroup.RemoveRawItemAt( oldRawItem.SortedIndex ); + m_sortedItemVersion++; + } + } - unchecked - { - m_sortedItemVersion++; - } - } + // In the case of a remove, the CollectionChanged must be after the CurrentChanged since when the DataGridCollectionView is used with a Selector having the + // IsSynchronizedWithCurrent set, the Selector will set the current position to -1 if the selected item is removed. + this.OnCollectionChanged( new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Remove, rawItem.DataItem, globalSortedIndex ) ); - // In the case of a remove, the CollectionChanged must be after the CurrentChanged since when the DataGridCollectionView is used with a Selector having the - // IsSynchronizedWithCurrent set, the Selector will set the current position to -1 if the selected item is removed. - this.OnCollectionChanged( new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Remove, oldRawItem.DataItem, globalSortedIndex ) ); - } + //When removing an item, make sure all stats for the specified group are recalculated even if UpdateChangedPropertyStatsOnly is set to true + if( m_statFunctions.Count > 0 ) + { + this.DeferredOperationManager.InvalidateGroupStats( parentGroup, true ); } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.DataGrid/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.DataGrid/AssemblyVersionInfo.cs index d542890a..0d5c200c 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.DataGrid/AssemblyVersionInfo.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.DataGrid/AssemblyVersionInfo.cs @@ -19,7 +19,7 @@ internal static class _XceedVersionInfo { [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] - public const string BaseVersion = "2.8"; + public const string BaseVersion = "2.9"; [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] public const string Version = BaseVersion + ".0.0"; [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DateTimeView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DateTimeView.xaml.txt index 7b8e6075..70209563 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DateTimeView.xaml.txt +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/DateTimeView.xaml.txt @@ -47,7 +47,19 @@ - + + + + + + + + + + + @@ -70,6 +82,7 @@ + @@ -90,12 +103,14 @@ - - - - - - + + + + + + + + @@ -107,6 +122,8 @@ + + @@ -129,7 +146,9 @@ Minimum="{Binding Value, ElementName=_minimum}" Maximum="{Binding Value, ElementName=_maximum}" Kind="{Binding SelectedItem, ElementName=_kind}" - ShowDropDownButton="{Binding IsChecked, ElementName=_showDropDownButton}" /> + CalendarDisplayMode="{Binding SelectedItem, ElementName=_calendarDisplayMode}" + ShowDropDownButton="{Binding IsChecked, ElementName=_showDropDownButton}" + CurrentDateTimePart="{Binding SelectedItem, ElementName=_currentDateTimePart, Mode=TwoWay}"/> diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MagnifierView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MagnifierView.xaml.txt index f3a63115..ef368120 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MagnifierView.xaml.txt +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/MagnifierView.xaml.txt @@ -22,78 +22,90 @@ xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer.Samples.Magnifier.Converters" Title="Magnifier"> - - - The Magnifier control allows the user to magnify parts of an application. - - + + + The Magnifier control allows the user to magnify parts of an application. + + - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - - - - + + + + + + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TimeSpanView.xaml.txt b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TimeSpanView.xaml.txt index 896fe276..5b838db7 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TimeSpanView.xaml.txt +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/CodeFiles/TimeSpanView.xaml.txt @@ -19,6 +19,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:local="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer" + xmlns:sys="clr-namespace:System;assembly=mscorlib" Title="TimeSpanUpDown"> + + + + + + + + @@ -40,6 +49,7 @@ + @@ -48,6 +58,7 @@ + + + + + + @@ -132,7 +169,9 @@ Maximum="5.00:00:00" Minimum="-5.00:00:00" ClipValueToMinMax="False" - FractionalSecondsDigitsCount="0"/> + FractionalSecondsDigitsCount="0" + CurrentDateTimePart="Hour24" + Step="1"/> diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Properties/AssemblyInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Properties/AssemblyInfo.cs index 59f85eca..37166cf5 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Properties/AssemblyInfo.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Properties/AssemblyInfo.cs @@ -49,8 +49,8 @@ using System.Windows; // 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( "2.8.*" )] -[assembly: AssemblyFileVersion( "2.8.0.0" )] +[assembly: AssemblyVersion( "2.9.*" )] +[assembly: AssemblyFileVersion( "2.9.0.0" )] #pragma warning disable 1699 [assembly: AssemblyDelaySign( false )] diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Properties/Resources.resx b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Properties/Resources.resx index e2fa0806..41922967 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Properties/Resources.resx +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Properties/Resources.resx @@ -3,7 +3,7 @@ + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - - - - + + + + + + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Samples/TimeSpan/Views/TimeSpanView.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Samples/TimeSpan/Views/TimeSpanView.xaml index 896fe276..5b838db7 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Samples/TimeSpan/Views/TimeSpanView.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit.LiveExplorer/Samples/TimeSpan/Views/TimeSpanView.xaml @@ -19,6 +19,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:local="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer" + xmlns:sys="clr-namespace:System;assembly=mscorlib" Title="TimeSpanUpDown"> + + + + + + + + @@ -40,6 +49,7 @@ + @@ -48,6 +58,7 @@ + + + + + + @@ -132,7 +169,9 @@ Maximum="5.00:00:00" Minimum="-5.00:00:00" ClipValueToMinMax="False" - FractionalSecondsDigitsCount="0"/> + FractionalSecondsDigitsCount="0" + CurrentDateTimePart="Hour24" + Step="1"/> diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs index 243365ac..84bce886 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs @@ -21,7 +21,7 @@ internal static class _XceedVersionInfo { [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] - public const string BaseVersion = "2.8"; + public const string BaseVersion = "2.9"; [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 89ff5281..a81e4779 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Implementation/ButtonSpinner.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Implementation/ButtonSpinner.cs @@ -266,6 +266,15 @@ namespace Xceed.Wpf.Toolkit break; } + case Key.Enter: + { + //Do not Spin on enter Key when spinners have focus + if( this.IncreaseButton.IsFocused || this.DecreaseButton.IsFocused ) + { + e.Handled = true; + } + break; + } } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Calculator/Implementation/Calculator.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Calculator/Implementation/Calculator.cs index 29b52fcf..4e21124f 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Calculator/Implementation/Calculator.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Calculator/Implementation/Calculator.cs @@ -436,6 +436,8 @@ namespace Xceed.Wpf.Toolkit { decimal currentValue = CalculatorUtilities.ParseDecimal( DisplayText ); + _showNewNumber = true; + switch( buttonType ) { case Calculator.CalculatorButtonType.MAdd: @@ -446,6 +448,7 @@ namespace Xceed.Wpf.Toolkit break; case Calculator.CalculatorButtonType.MR: DisplayText = Memory.ToString(); + _showNewNumber = false; break; case Calculator.CalculatorButtonType.MS: Memory = currentValue; @@ -456,8 +459,6 @@ namespace Xceed.Wpf.Toolkit default: break; } - - _showNewNumber = true; } private void ProcessOperationKey( CalculatorButtonType buttonType ) diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CalculatorUpDown/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CalculatorUpDown/Themes/Aero2.NormalColor.xaml index 62556be1..c86d9e57 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CalculatorUpDown/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CalculatorUpDown/Themes/Aero2.NormalColor.xaml @@ -19,7 +19,8 @@ xmlns:local="clr-namespace:Xceed.Wpf.Toolkit" xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes" xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes" - xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"> + xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -112,6 +113,7 @@ Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" + IsTabStop="{TemplateBinding IsTabStop}" MinWidth="20" AcceptsReturn="False" Padding="{TemplateBinding Padding}" @@ -133,9 +135,21 @@ IsHitTestVisible="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}" /> - + IsOpen="{Binding IsChecked, ElementName=_calculatorToggleButton}" + StaysOpen="False" + ToolTip="{x:Static sys:String.Empty}"> + + + + + xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -123,6 +124,7 @@ Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" + IsTabStop="{TemplateBinding IsTabStop}" MinWidth="20" AcceptsReturn="False" Padding="{TemplateBinding Padding}" @@ -144,7 +146,19 @@ IsHitTestVisible="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}" /> + StaysOpen="False" + ToolTip="{x:Static sys:String.Empty}"> + + + - + @@ -30,15 +30,24 @@ - - - - + ItemsSourceType="{Binding ItemsSourceType, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" + ItemsSource="{Binding ItemsSource, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Mode=TwoWay}" + NewItemTypes="{Binding NewItemTypes, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" + IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" /> + + + + - + 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 ddea5371..b9196386 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CollectionControl/Implementation/CollectionControlDialog.xaml.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/CollectionControl/Implementation/CollectionControlDialog.xaml.cs @@ -18,15 +18,27 @@ using System; using System.Collections; using System.Collections.Generic; using System.Windows; +using System.Windows.Media; namespace Xceed.Wpf.Toolkit { + public partial class CollectionControlDialogBase : + Window + { + } + /// /// Interaction logic for CollectionControlDialog.xaml /// - public partial class CollectionControlDialog : Window + public partial class CollectionControlDialog : CollectionControlDialogBase { - #region Properties +#region Private Members + + private IList originalData = new List(); + +#endregion + +#region Properties public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register( "ItemsSource", typeof( IList ), typeof( CollectionControlDialog ), new UIPropertyMetadata( null ) ); public IList ItemsSource @@ -88,9 +100,9 @@ namespace Xceed.Wpf.Toolkit } } - #endregion //Properties +#endregion //Properties - #region Constructors +#region Constructors public CollectionControlDialog() { @@ -109,23 +121,76 @@ namespace Xceed.Wpf.Toolkit NewItemTypes = newItemTypes; } - #endregion //Constructors +#endregion //Constructors - #region Event Handlers +#region Overrides + + protected override void OnSourceInitialized( EventArgs e ) + { + base.OnSourceInitialized( e ); + + //Backup data in case "Cancel" is clicked. + if( this.ItemsSource != null ) + { + foreach( var item in this.ItemsSource ) + { + originalData.Add( this.Clone( item ) ); + } + } + } + +#endregion + +#region Event Handlers private void OkButton_Click( object sender, RoutedEventArgs e ) { _collectionControl.PersistChanges(); this.DialogResult = true; - Close(); + this.Close(); } private void CancelButton_Click( object sender, RoutedEventArgs e ) { + _collectionControl.PersistChanges( originalData ); this.DialogResult = false; - Close(); + this.Close(); + } + +#endregion //Event Hanlders + +#region Private Methods + + private object Clone( object source ) + { + var sourceType = source.GetType(); + //Get default constructor + var result = sourceType.GetConstructor( new Type[] { } ).Invoke( null ); + var properties = sourceType.GetProperties(); + + foreach( var propertyInfo in properties ) + { + var propertyInfoValue = propertyInfo.GetValue( source, null ); + + if( propertyInfo.CanWrite ) + { + //Look for nested object + if( propertyInfo.PropertyType.IsClass && (propertyInfo.PropertyType != typeof(Transform)) && !propertyInfo.PropertyType.Equals( typeof( string ) ) ) + { + var nestedObject = this.Clone( propertyInfoValue ); + propertyInfo.SetValue( result, nestedObject, null ); + } + else + { + // copy object + propertyInfo.SetValue( result, propertyInfoValue, null ); + } + } + } + + return result; } - #endregion //Event Hanlders +#endregion } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Implementation/ColorPicker.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Implementation/ColorPicker.cs index 8e9e560e..028814e8 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Implementation/ColorPicker.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Implementation/ColorPicker.cs @@ -208,7 +208,7 @@ namespace Xceed.Wpf.Toolkit #region IsOpen - public static readonly DependencyProperty IsOpenProperty = DependencyProperty.Register( "IsOpen", typeof( bool ), typeof( ColorPicker ), new UIPropertyMetadata( false ) ); + public static readonly DependencyProperty IsOpenProperty = DependencyProperty.Register( "IsOpen", typeof( bool ), typeof( ColorPicker ), new UIPropertyMetadata( false, OnIsOpenChanged ) ); public bool IsOpen { get @@ -221,6 +221,19 @@ namespace Xceed.Wpf.Toolkit } } + private static void OnIsOpenChanged( DependencyObject d, DependencyPropertyChangedEventArgs e ) + { + ColorPicker colorPicker = (ColorPicker)d; + if( colorPicker != null ) + colorPicker.OnIsOpenChanged( (bool)e.OldValue, (bool)e.NewValue ); + } + + private void OnIsOpenChanged( bool oldValue, bool newValue ) + { + RoutedEventArgs args = new RoutedEventArgs( newValue ? OpenedEvent : ClosedEvent, this ); + this.RaiseEvent( args ); + } + #endregion //IsOpen #region RecentColors @@ -629,6 +642,8 @@ namespace Xceed.Wpf.Toolkit #region Events + #region SelectedColorChangedEvent + public static readonly RoutedEvent SelectedColorChangedEvent = EventManager.RegisterRoutedEvent( "SelectedColorChanged", RoutingStrategy.Bubble, typeof( RoutedPropertyChangedEventHandler ), typeof( ColorPicker ) ); public event RoutedPropertyChangedEventHandler SelectedColorChanged { @@ -642,6 +657,42 @@ namespace Xceed.Wpf.Toolkit } } + #endregion + + #region OpenedEvent + + public static readonly RoutedEvent OpenedEvent = EventManager.RegisterRoutedEvent( "OpenedEvent", RoutingStrategy.Bubble, typeof( RoutedEventHandler ), typeof( ColorPicker ) ); + public event RoutedEventHandler Opened + { + add + { + AddHandler( OpenedEvent, value ); + } + remove + { + RemoveHandler( OpenedEvent, value ); + } + } + + #endregion //OpenedEvent + + #region ClosedEvent + + public static readonly RoutedEvent ClosedEvent = EventManager.RegisterRoutedEvent( "ClosedEvent", RoutingStrategy.Bubble, typeof( RoutedEventHandler ), typeof( ColorPicker ) ); + public event RoutedEventHandler Closed + { + add + { + AddHandler( ClosedEvent, value ); + } + remove + { + RemoveHandler( ClosedEvent, value ); + } + } + + #endregion //ClosedEvent + #endregion //Events #region Methods 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 30072651..d758a3c5 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Aero2.NormalColor.xaml @@ -286,7 +286,19 @@ Focusable="False" HorizontalOffset="1" VerticalOffset="1" - PopupAnimation="Slide"> + PopupAnimation="Slide" + ToolTip="{x:Static sys:String.Empty}"> + + + - + + + + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Converters/NullToBoolConverter.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Converters/NullToBoolConverter.cs new file mode 100644 index 00000000..75650e12 --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Converters/NullToBoolConverter.cs @@ -0,0 +1,35 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 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 + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Xceed.Wpf.Toolkit.Core.Converters +{ + public class NullToBoolConverter : IValueConverter + { + public object Convert( object value, Type targetType, object parameter, CultureInfo culture ) + { + return (value == null); + } + + public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture ) + { + throw new NotImplementedException(); + } + } +} diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Utilities/CalculatorUtilities.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Utilities/CalculatorUtilities.cs index 5cb08c58..346fce99 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Utilities/CalculatorUtilities.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Core/Utilities/CalculatorUtilities.cs @@ -234,7 +234,9 @@ namespace Xceed.Wpf.Toolkit.Core.Utilities public static decimal ParseDecimal( string text ) { - return Decimal.Parse( text, CultureInfo.CurrentCulture ); + decimal result; + var success = Decimal.TryParse( text, NumberStyles.Any, CultureInfo.CurrentCulture, out result ); + return success ? result : decimal.Zero; } public static decimal Add( decimal firstNumber, decimal secondNumber ) diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Implementation/DateTimePicker.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Implementation/DateTimePicker.cs index 7c28f129..a64a9d47 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Implementation/DateTimePicker.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Implementation/DateTimePicker.cs @@ -63,6 +63,24 @@ namespace Xceed.Wpf.Toolkit #endregion //AutoCloseCalendar + #region CalendarDisplayMode + + public static readonly DependencyProperty CalendarDisplayModeProperty = DependencyProperty.Register( "CalendarDisplayMode", typeof( CalendarMode ) + , typeof( DateTimePicker ), new UIPropertyMetadata( CalendarMode.Month ) ); + public CalendarMode CalendarDisplayMode + { + get + { + return (CalendarMode)GetValue( CalendarDisplayModeProperty ); + } + set + { + SetValue( CalendarDisplayModeProperty, value ); + } + } + + #endregion //CalendarDisplayMode + #region TimeFormat public static readonly DependencyProperty TimeFormatProperty = DependencyProperty.Register( "TimeFormat", typeof( DateTimeFormat ), typeof( DateTimePicker ), new UIPropertyMetadata( DateTimeFormat.ShortTime ) ); 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 f4269a3b..24b32588 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Aero2.NormalColor.xaml @@ -19,82 +19,83 @@ xmlns:local="clr-namespace:Xceed.Wpf.Toolkit" xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes" xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes" - xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + - - - + - - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Generic.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Generic.xaml index 9b5f0a8d..27f3a2f2 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Generic.xaml @@ -19,7 +19,8 @@ xmlns:local="clr-namespace:Xceed.Wpf.Toolkit" xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes" xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes" - xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"> + xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -127,6 +128,7 @@ HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsUndoEnabled="{Binding IsUndoEnabled, RelativeSource={RelativeSource TemplatedParent}}" + IsTabStop="{TemplateBinding IsTabStop}" MinWidth="20" AcceptsReturn="False" Padding="{TemplateBinding Padding}" @@ -147,10 +149,26 @@ IsEnabled="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}" Visibility="{TemplateBinding ShowDropDownButton, Converter={StaticResource BooleanToVisibilityConverter}}"/> - + + + + - + + xmlns:local="clr-namespace:Xceed.Wpf.Toolkit" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -104,7 +105,19 @@ StaysOpen="False" Placement="Bottom" Focusable="False" - IsOpen="{Binding IsChecked, ElementName=PART_DropDownButton}"> + IsOpen="{Binding IsChecked, ElementName=PART_DropDownButton}" + ToolTip="{x:Static sys:String.Empty}"> + + + + xmlns:local="clr-namespace:Xceed.Wpf.Toolkit" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -122,7 +123,19 @@ StaysOpen="False" Placement="Bottom" Focusable="False" - IsOpen="{Binding IsChecked, ElementName=PART_DropDownButton}"> + IsOpen="{Binding IsChecked, ElementName=PART_DropDownButton}" + ToolTip="{x:Static sys:String.Empty}"> + + + = 0); + } + + private static void OnZoomFactorOnMouseWheelPropertyChanged( DependencyObject d, DependencyPropertyChangedEventArgs e ) + { + Magnifier m = (Magnifier)d; + m.OnZoomFactorOnMouseWheelChanged( e ); + } + + protected virtual void OnZoomFactorOnMouseWheelChanged( DependencyPropertyChangedEventArgs e ) + { + } + + #endregion //ZoomFactorOnMouseWheel + #endregion //Properties #region Constructors diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Magnifier/Implementation/MagnifierManager.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Magnifier/Implementation/MagnifierManager.cs index 2af25cbf..6c66bac1 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Magnifier/Implementation/MagnifierManager.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Magnifier/Implementation/MagnifierManager.cs @@ -57,25 +57,53 @@ namespace Xceed.Wpf.Toolkit #region Event Handlers - void Element_MouseLeave( object sender, MouseEventArgs e ) + private void Element_MouseLeave( object sender, MouseEventArgs e ) { HideAdorner(); } - void Element_MouseEnter( object sender, MouseEventArgs e ) + private void Element_MouseEnter( object sender, MouseEventArgs e ) { ShowAdorner(); } - #endregion //Event Handlers + private void Element_MouseWheel( object sender, MouseWheelEventArgs e ) + { + var magnifier = MagnifierManager.GetMagnifier( _element ) as Magnifier; + if( (magnifier != null) && magnifier.IsUsingZoomOnMouseWheel ) + { + if( e.Delta < 0 ) + { + var newValue = magnifier.ZoomFactor + magnifier.ZoomFactorOnMouseWheel; +#if VS2008 + magnifier.ZoomFactor = newValue; +#else + magnifier.SetCurrentValue( Magnifier.ZoomFactorProperty, newValue ); +#endif + } + else if ( e.Delta > 0 ) + { + var newValue = (magnifier.ZoomFactor >= magnifier.ZoomFactorOnMouseWheel) ? magnifier.ZoomFactor - magnifier.ZoomFactorOnMouseWheel : 0d; +#if VS2008 + magnifier.ZoomFactor = newValue; +#else + magnifier.SetCurrentValue( Magnifier.ZoomFactorProperty, newValue ); +#endif + } + _adorner.UpdateViewBox(); + } + } + +#endregion //Event Handlers - #region Methods +#region Methods private void AttachToMagnifier( UIElement element, Magnifier magnifier ) { _element = element; _element.MouseEnter += Element_MouseEnter; _element.MouseLeave += Element_MouseLeave; + _element.MouseWheel += Element_MouseWheel; magnifier.Target = _element; @@ -109,6 +137,6 @@ namespace Xceed.Wpf.Toolkit } } - #endregion //Methods +#endregion //Methods } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Aero2.NormalColor.xaml index 7e672b5b..93dd7f8a 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Aero2.NormalColor.xaml @@ -19,7 +19,8 @@ xmlns:local="clr-namespace:Xceed.Wpf.Toolkit" xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes" xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes" - xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"> + xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -145,7 +146,19 @@ Focusable="False" PopupAnimation="Slide" Width="{TemplateBinding DropDownWidth}" - Height="{TemplateBinding DropDownHeight}"> + Height="{TemplateBinding DropDownHeight}" + ToolTip="{x:Static sys:String.Empty}"> + + + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Generic.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Generic.xaml index 97b07451..8454e72e 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Generic.xaml @@ -18,7 +18,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Xceed.Wpf.Toolkit" xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes" - xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"> + xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -132,7 +133,19 @@ Focusable="False" PopupAnimation="Slide" Width="{TemplateBinding DropDownWidth}" - Height="{TemplateBinding DropDownHeight}"> + Height="{TemplateBinding DropDownHeight}" + ToolTip="{x:Static sys:String.Empty}"> + + + ), new UIPropertyMetadata( DateTimePart.Other, OnCurrentDateTimePartChanged ) ); + public DateTimePart CurrentDateTimePart + { + get + { + return (DateTimePart)GetValue( CurrentDateTimePartProperty ); + } + set + { + SetValue( CurrentDateTimePartProperty, value ); + } + } + + private static void OnCurrentDateTimePartChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + DateTimeUpDownBase dateTimeUpDownBase = o as DateTimeUpDownBase; + if( dateTimeUpDownBase != null ) + dateTimeUpDownBase.OnCurrentDateTimePartChanged( (DateTimePart)e.OldValue, (DateTimePart)e.NewValue ); + } + + protected virtual void OnCurrentDateTimePartChanged( DateTimePart oldValue, DateTimePart newValue ) + { + this.Select( this.GetDateTimeInfo( newValue ) ); + } + + #endregion //CurrentDateTimePart + + #region Step + + public static readonly DependencyProperty StepProperty = DependencyProperty.Register( "Step", typeof( int ) + , typeof( DateTimeUpDownBase ), new UIPropertyMetadata( 1, OnStepChanged ) ); + public int Step + { + get + { + return (int)GetValue( StepProperty ); + } + set + { + SetValue( StepProperty, value ); + } + } + + private static void OnStepChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + var dateTimeUpDownBase = o as DateTimeUpDownBase; + if( dateTimeUpDownBase != null ) + dateTimeUpDownBase.OnStepChanged( (int)e.OldValue, (int)e.NewValue ); + } + + protected virtual void OnStepChanged( int oldValue, int newValue ) + { + } + + #endregion //Step + + #endregion + #region Constructors internal DateTimeUpDownBase() { this.InitializeDateTimeInfoList(); + this.Loaded += this.DateTimeUpDownBase_Loaded; } #endregion @@ -51,7 +115,6 @@ namespace Xceed.Wpf.Toolkit.Primitives { if( this.TextBox != null ) { - this.TextBox.GotFocus -= new RoutedEventHandler( this.TextBox_GotFocus ); this.TextBox.SelectionChanged -= this.TextBox_SelectionChanged; } @@ -59,7 +122,6 @@ namespace Xceed.Wpf.Toolkit.Primitives if( this.TextBox != null ) { - this.TextBox.GotFocus += new RoutedEventHandler( this.TextBox_GotFocus ); this.TextBox.SelectionChanged += this.TextBox_SelectionChanged; } } @@ -150,12 +212,9 @@ namespace Xceed.Wpf.Toolkit.Primitives _fireSelectionChangedEvent = true; } - private void TextBox_GotFocus( object sender, RoutedEventArgs e ) + private void DateTimeUpDownBase_Loaded( object sender, RoutedEventArgs e ) { - if( _selectedDateTimeInfo == null ) - { - this.Select( this.GetDateTimeInfo( 0 ) ); - } + this.InitSelection(); } #endregion @@ -192,14 +251,24 @@ namespace Xceed.Wpf.Toolkit.Primitives ( info.StartPosition <= selectionStart ) && ( selectionStart < ( info.StartPosition + info.Length ) ) ); } + internal DateTimeInfo GetDateTimeInfo( DateTimePart part ) + { + return _dateTimeInfoList.FirstOrDefault( ( info ) =>info.Type == part ); + } + internal void Select( DateTimeInfo info ) { - if( info != null ) + if( (info != null) && !info.Equals( _selectedDateTimeInfo ) && ( this.TextBox != null) && !string.IsNullOrEmpty( this.TextBox.Text ) ) { _fireSelectionChangedEvent = false; this.TextBox.Select( info.StartPosition, info.Length ); _fireSelectionChangedEvent = true; _selectedDateTimeInfo = info; +#if VS2008 + this.CurrentDateTimePart = info.Type; +#else + this.SetCurrentValue( DateTimeUpDownBase.CurrentDateTimePartProperty, info.Type ); +#endif } } @@ -301,6 +370,14 @@ namespace Xceed.Wpf.Toolkit.Primitives return previousDateTimeInfo; } + private void InitSelection() + { + if( _selectedDateTimeInfo == null ) + { + this.Select( (this.CurrentDateTimePart != DateTimePart.Other) ? this.GetDateTimeInfo( this.CurrentDateTimePart ) : this.GetDateTimeInfo( 0 ) ); + } + } + #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 5e1f3f58..ca8e0845 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Aero2/WindowControl.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Aero2/WindowControl.xaml @@ -25,7 +25,7 @@ - 8 + 5 @@ -65,7 +65,7 @@ - + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Generic/WindowControl.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Generic/WindowControl.xaml index 41d6cfe9..68f62ec4 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Generic/WindowControl.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Generic/WindowControl.xaml @@ -25,7 +25,7 @@ - 8 + 5 @@ -67,7 +67,7 @@ - + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/UpDownBase.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/UpDownBase.cs index 2b899dd4..5259cee9 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/UpDownBase.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/UpDownBase.cs @@ -566,6 +566,8 @@ namespace Xceed.Wpf.Toolkit.Primitives public event InputValidationErrorEventHandler InputValidationError; + public event EventHandler Spinned; + #region ValueChanged Event //Due to a bug in Visual Studio, you cannot create event handlers for generic T args in XAML, so I have to use object instead. @@ -593,6 +595,13 @@ namespace Xceed.Wpf.Toolkit.Primitives if( e == null ) throw new ArgumentNullException( "e" ); + // Raise the Spinned event to user + EventHandler handler = this.Spinned; + if( handler != null ) + { + handler( this, e ); + } + if( e.Direction == SpinDirection.Increase ) DoIncrement(); else diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/CategoryGroupStyleSelector.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/CategoryGroupStyleSelector.cs new file mode 100644 index 00000000..80af7896 --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/CategoryGroupStyleSelector.cs @@ -0,0 +1,65 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 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 + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System.ComponentModel; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Media; + +namespace Xceed.Wpf.Toolkit.PropertyGrid +{ + public class CategoryGroupStyleSelector : StyleSelector + { + public Style SingleDefaultCategoryItemGroupStyle + { + get; + set; + } + public Style ItemGroupStyle + { + get; + set; + } + + public override Style SelectStyle( object item, DependencyObject container ) + { + var group = item as CollectionViewGroup; + // Category is not "Misc" => use regular ItemGroupStyle + if( !group.Name.Equals( CategoryAttribute.Default.Category ) ) + return this.ItemGroupStyle; + + // Category is "Misc" + while( container != null ) + { + container = VisualTreeHelper.GetParent( container ); + if( container is ItemsControl ) + break; + } + + var itemsControl = container as ItemsControl; + if( itemsControl != null ) + { + // Category is "Misc" and this is the only category => use SingleDefaultCategoryItemGroupContainerStyle + if( (itemsControl.Items.Count > 0) && (itemsControl.Items.Groups.Count == 1) ) + return this.SingleDefaultCategoryItemGroupStyle; + } + + // Category is "Misc" and this is NOT the only category => use regular ItemGroupStyle + return this.ItemGroupStyle; + } + } +} diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs index 1fcc68c1..edc107e8 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs @@ -101,7 +101,7 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid //Bind the value property with the source object. var binding = new Binding( PropertyDescriptor.Name ) { - Source = SelectedObject, + Source = this.GetValueInstance( SelectedObject ), Mode = PropertyDescriptor.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay, ValidatesOnDataErrors = true, ValidatesOnExceptions = true, diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinitionBase.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinitionBase.cs index ee8cdb3e..fd703cb4 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinitionBase.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinitionBase.cs @@ -152,15 +152,12 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid bool isResource = false; bool isDynamicResource = false; - var markupProperty = markupObject.Properties.Where( p => p.Name == PropertyName ).FirstOrDefault(); - if( ( markupProperty != null ) - && ( markupProperty.PropertyType != typeof( object ) ) - && !markupProperty.PropertyType.IsEnum - && !markupProperty.PropertyType.IsArray ) - { - //TODO: need to find a better way to determine if a StaticResource has been applied to any property not just a style - isResource = ( markupProperty.Value is Style ); - isDynamicResource = ( markupProperty.Value is DynamicResourceExtension ); + var markupProperty = markupObject.Properties.FirstOrDefault( p => p.Name == PropertyName ); + if( markupProperty != null ) + { + //TODO: need to find a better way to determine if a StaticResource has been applied to any property not just a style(maybe with StaticResourceExtension) + isResource = typeof( Style ).IsAssignableFrom( markupProperty.PropertyType ); + isDynamicResource = typeof( DynamicResourceExtension ).IsAssignableFrom( markupProperty.PropertyType ); } if( isResource || isDynamicResource ) @@ -293,6 +290,15 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid return this.ComputeDisplayOrder( isPropertyGridCategorized ); } + internal object GetValueInstance( object sourceObject ) + { + ICustomTypeDescriptor customTypeDescriptor = sourceObject as ICustomTypeDescriptor; + if( customTypeDescriptor != null ) + sourceObject = customTypeDescriptor.GetPropertyOwner( PropertyDescriptor ); + + return sourceObject; + } + #endregion #region Private Methods diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/FontComboBoxEditor.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/FontComboBoxEditor.cs index ffefd454..be62f2c6 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/FontComboBoxEditor.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/FontComboBoxEditor.cs @@ -28,7 +28,7 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid.Editors protected override IEnumerable CreateItemsSource( PropertyItem propertyItem ) { if( propertyItem.PropertyType == typeof( FontFamily ) ) - return FontUtilities.Families; + return FontUtilities.Families.OrderBy( x => x.Source); else if( propertyItem.PropertyType == typeof( FontWeight ) ) return FontUtilities.Weights; else if( propertyItem.PropertyType == typeof( FontStyle ) ) diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/IPropertyContainer.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/IPropertyContainer.cs index 465ff068..2f8c3ace 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/IPropertyContainer.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/IPropertyContainer.cs @@ -49,5 +49,7 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid bool HideInheritedProperties { get; } FilterInfo FilterInfo { get; } + + bool? IsPropertyVisible( PropertyDescriptor pd ); } } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelper.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelper.cs index 15e83471..fd54ce5e 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelper.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelper.cs @@ -59,11 +59,22 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid foreach( var descriptor in descriptors ) { var propertyDef = this.GetPropertyDefinition( descriptor ); - bool isBrowsable = descriptor.IsBrowsable && this.PropertyContainer.AutoGenerateProperties; - if( propertyDef != null ) + bool isBrowsable = false; + + var isPropertyBrowsable = this.PropertyContainer.IsPropertyVisible( descriptor ); + if( isPropertyBrowsable.HasValue ) + { + isBrowsable = isPropertyBrowsable.Value; + } + else { - isBrowsable = propertyDef.IsBrowsable.GetValueOrDefault( isBrowsable ); + isBrowsable = descriptor.IsBrowsable && this.PropertyContainer.AutoGenerateProperties; + if( propertyDef != null ) + { + isBrowsable = propertyDef.IsBrowsable.GetValueOrDefault( isBrowsable ); + } } + if( isBrowsable ) { var prop = this.CreatePropertyItem( descriptor, propertyDef ); diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs index 16106b33..76d083fd 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs @@ -258,9 +258,20 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid if( tc == null || !tc.GetPropertiesSupported() ) { if( instance is ICustomTypeDescriptor ) - descriptors = ( ( ICustomTypeDescriptor )instance ).GetProperties(); + { + descriptors = ((ICustomTypeDescriptor)instance).GetProperties(); + } + //ICustomTypeProvider is only available in .net 4.5 and over. Use reflection so the .net 4.0 and .net 3.5 still works. + else if( instance.GetType().GetInterface( "ICustomTypeProvider", true ) != null ) + { + var methodInfo = instance.GetType().GetMethod( "GetCustomType" ); + var result = methodInfo.Invoke( instance, null ) as Type; + descriptors = TypeDescriptor.GetProperties( result ); + } else + { descriptors = TypeDescriptor.GetProperties( instance.GetType() ); + } } else { diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyGrid.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyGrid.cs index ed840253..c61909fc 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyGrid.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyGrid.cs @@ -1071,6 +1071,12 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid #endregion + #region IsPropertyBrowsable Event + + public event IsPropertyBrowsableHandler IsPropertyBrowsable; + + #endregion + #region PreparePropertyItemEvent Attached Routed Event /// @@ -1234,6 +1240,21 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid } + bool? IPropertyContainer.IsPropertyVisible( PropertyDescriptor pd ) + { + var handler = this.IsPropertyBrowsable; + //If anyone is registered to PropertyGrid.IsPropertyBrowsable event + if( handler != null ) + { + var isBrowsableArgs = new IsPropertyBrowsableArgs( pd ); + handler( this, isBrowsableArgs ); + + return isBrowsableArgs.IsBrowsable; + } + + return null; + } + #endregion @@ -1290,4 +1311,54 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid } #endregion + #region isPropertyBrowsableEvent Handler/Args + + public delegate void IsPropertyBrowsableHandler( object sender, IsPropertyBrowsableArgs e ); + + public class IsPropertyBrowsableArgs : RoutedEventArgs + { + #region Constructors + + public IsPropertyBrowsableArgs( PropertyDescriptor pd ) + { + this.PropertyDescriptor = pd; + } + + #endregion + + #region Properties + + #region IsBrowsable Property + + public bool IsBrowsable + { + get + { + return _isBrowsable; + } + set + { + _isBrowsable = value; + } + } + + private bool _isBrowsable = true; + + #endregion + + #region PropertyDescriptor Property + + public PropertyDescriptor PropertyDescriptor + { + get; + private set; + } + + #endregion + + #endregion + } + + #endregion + } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyItemBase.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyItemBase.cs index 10e6d317..fabcd7c0 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyItemBase.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyItemBase.cs @@ -498,6 +498,16 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid get { return new FilterInfo(); } } + bool? IPropertyContainer.IsPropertyVisible( PropertyDescriptor pd ) + { + if( _parentNode != null ) + { + return _parentNode.IsPropertyVisible( pd ); + } + + return null; + } + #endregion } 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 0b850d1f..4126a1ef 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml @@ -26,164 +26,213 @@ xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes" xmlns:sys="clr-namespace:System;assembly=mscorlib"> - - - - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - @@ -215,27 +270,32 @@ - - - - - - @@ -311,210 +391,352 @@ - - - + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml index a1dab8ec..a34618d1 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml @@ -41,10 +41,12 @@ + + @@ -880,7 +882,7 @@ - + @@ -889,6 +891,18 @@ + + @@ -896,6 +910,11 @@ Command="commands:PropertyItemCommands.ResetValue" /> + + + + + xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -144,6 +145,7 @@ HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsUndoEnabled="{Binding IsUndoEnabled, RelativeSource={RelativeSource TemplatedParent}}" + IsTabStop="{TemplateBinding IsTabStop}" MinWidth="20" AcceptsReturn="False" Padding="{TemplateBinding Padding}" @@ -166,7 +168,19 @@ + StaysOpen="False" + ToolTip="{x:Static sys:String.Empty}"> + + + = 0 ) ) ? info.StartPosition + 1 : info.StartPosition; + int startPos = (this.GetDateTimeInfo( info.Type ) != null) ? this.GetDateTimeInfo( info.Type ).StartPosition : info.StartPosition; + if( result.HasValue && (result.Value.TotalMilliseconds < 0) && oldValue.HasValue && (oldValue.Value.TotalMilliseconds >= 0) ) + { + startPos += 1; + } this.TextBox.Select( startPos, info.Length ); _fireSelectionChangedEvent = true; } diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Aero2.NormalColor.xaml index fed46ddc..4e1d4c9e 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Aero2.NormalColor.xaml @@ -47,7 +47,9 @@ Value="Center" /> - + @@ -77,6 +79,7 @@ HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsUndoEnabled="{Binding IsUndoEnabled, RelativeSource={RelativeSource TemplatedParent}}" + IsTabStop="{TemplateBinding IsTabStop}" MinWidth="20" AcceptsReturn="False" Padding="{TemplateBinding Padding}" diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Generic.xaml b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Generic.xaml index 8594f120..f8d8fe3d 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Generic.xaml @@ -50,6 +50,8 @@ Value="{StaticResource DefaultWatermarkTemplate}" /> + @@ -76,6 +78,7 @@ HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsUndoEnabled="{Binding IsUndoEnabled, RelativeSource={RelativeSource TemplatedParent}}" + IsTabStop="{TemplateBinding IsTabStop}" MinWidth="20" AcceptsReturn="False" Padding="{TemplateBinding Padding}" diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj index 2f1e1d1c..325f7638 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj @@ -413,9 +413,11 @@ + + diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Zoombox/Zoombox.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Zoombox/Zoombox.cs index 561f09dd..c086aa25 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Zoombox/Zoombox.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Zoombox/Zoombox.cs @@ -1600,6 +1600,8 @@ namespace Xceed.Wpf.Toolkit.Zoombox #endregion + public event EventHandler Scroll; + #region ViewStackIndexChanged Event public static readonly RoutedEvent ViewStackIndexChangedEvent = EventManager.RegisterRoutedEvent( "ViewStackIndexChanged", RoutingStrategy.Bubble, typeof( IndexChangedEventHandler ), typeof( Zoombox ) ); @@ -2275,12 +2277,26 @@ namespace Xceed.Wpf.Toolkit.Zoombox { double diff = e.NewValue + _relativePosition.Y; this.OnDrag( new DragDeltaEventArgs( 0d, -diff / this.Scale ), false ); + + // Raise the Scroll event to user + EventHandler handler = this.Scroll; + if( handler != null ) + { + handler( this, e ); + } } private void HorizontalScrollBar_Scroll( object sender, ScrollEventArgs e ) { double diff = e.NewValue + _relativePosition.X; this.OnDrag( new DragDeltaEventArgs( -diff / this.Scale, 0d ), false ); + + // Raise the Scroll event to user + EventHandler handler = this.Scroll; + if( handler != null ) + { + handler( this, e ); + } } private void DragDisplayViewport( DragDeltaEventArgs e, bool end ) diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs index 243365ac..84bce886 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/AssemblyVersionInfo.cs @@ -21,7 +21,7 @@ internal static class _XceedVersionInfo { [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] - public const string BaseVersion = "2.8"; + public const string BaseVersion = "2.9"; [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields" )] public const string Version = BaseVersion + ".0.0"; diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Implementation/ButtonSpinner.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Implementation/ButtonSpinner.cs index 89ff5281..a81e4779 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Implementation/ButtonSpinner.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/ButtonSpinner/Implementation/ButtonSpinner.cs @@ -266,6 +266,15 @@ namespace Xceed.Wpf.Toolkit break; } + case Key.Enter: + { + //Do not Spin on enter Key when spinners have focus + if( this.IncreaseButton.IsFocused || this.DecreaseButton.IsFocused ) + { + e.Handled = true; + } + break; + } } } diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Calculator/Implementation/Calculator.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Calculator/Implementation/Calculator.cs index 29b52fcf..4e21124f 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Calculator/Implementation/Calculator.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Calculator/Implementation/Calculator.cs @@ -436,6 +436,8 @@ namespace Xceed.Wpf.Toolkit { decimal currentValue = CalculatorUtilities.ParseDecimal( DisplayText ); + _showNewNumber = true; + switch( buttonType ) { case Calculator.CalculatorButtonType.MAdd: @@ -446,6 +448,7 @@ namespace Xceed.Wpf.Toolkit break; case Calculator.CalculatorButtonType.MR: DisplayText = Memory.ToString(); + _showNewNumber = false; break; case Calculator.CalculatorButtonType.MS: Memory = currentValue; @@ -456,8 +459,6 @@ namespace Xceed.Wpf.Toolkit default: break; } - - _showNewNumber = true; } private void ProcessOperationKey( CalculatorButtonType buttonType ) diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/CalculatorUpDown/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/CalculatorUpDown/Themes/Aero2.NormalColor.xaml index 62556be1..c86d9e57 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/CalculatorUpDown/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/CalculatorUpDown/Themes/Aero2.NormalColor.xaml @@ -19,7 +19,8 @@ xmlns:local="clr-namespace:Xceed.Wpf.Toolkit" xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes" xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes" - xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"> + xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -112,6 +113,7 @@ Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" + IsTabStop="{TemplateBinding IsTabStop}" MinWidth="20" AcceptsReturn="False" Padding="{TemplateBinding Padding}" @@ -133,9 +135,21 @@ IsHitTestVisible="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}" /> - + IsOpen="{Binding IsChecked, ElementName=_calculatorToggleButton}" + StaysOpen="False" + ToolTip="{x:Static sys:String.Empty}"> + + + + + xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -123,6 +124,7 @@ Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" + IsTabStop="{TemplateBinding IsTabStop}" MinWidth="20" AcceptsReturn="False" Padding="{TemplateBinding Padding}" @@ -144,7 +146,19 @@ IsHitTestVisible="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}" /> + StaysOpen="False" + ToolTip="{x:Static sys:String.Empty}"> + + + - + @@ -30,15 +30,24 @@ - - - - + ItemsSourceType="{Binding ItemsSourceType, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" + ItemsSource="{Binding ItemsSource, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Mode=TwoWay}" + NewItemTypes="{Binding NewItemTypes, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" + IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" /> + + + + - + diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/CollectionControl/Implementation/CollectionControlDialog.xaml.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/CollectionControl/Implementation/CollectionControlDialog.xaml.cs index ddea5371..b9196386 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/CollectionControl/Implementation/CollectionControlDialog.xaml.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/CollectionControl/Implementation/CollectionControlDialog.xaml.cs @@ -18,15 +18,27 @@ using System; using System.Collections; using System.Collections.Generic; using System.Windows; +using System.Windows.Media; namespace Xceed.Wpf.Toolkit { + public partial class CollectionControlDialogBase : + Window + { + } + /// /// Interaction logic for CollectionControlDialog.xaml /// - public partial class CollectionControlDialog : Window + public partial class CollectionControlDialog : CollectionControlDialogBase { - #region Properties +#region Private Members + + private IList originalData = new List(); + +#endregion + +#region Properties public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register( "ItemsSource", typeof( IList ), typeof( CollectionControlDialog ), new UIPropertyMetadata( null ) ); public IList ItemsSource @@ -88,9 +100,9 @@ namespace Xceed.Wpf.Toolkit } } - #endregion //Properties +#endregion //Properties - #region Constructors +#region Constructors public CollectionControlDialog() { @@ -109,23 +121,76 @@ namespace Xceed.Wpf.Toolkit NewItemTypes = newItemTypes; } - #endregion //Constructors +#endregion //Constructors - #region Event Handlers +#region Overrides + + protected override void OnSourceInitialized( EventArgs e ) + { + base.OnSourceInitialized( e ); + + //Backup data in case "Cancel" is clicked. + if( this.ItemsSource != null ) + { + foreach( var item in this.ItemsSource ) + { + originalData.Add( this.Clone( item ) ); + } + } + } + +#endregion + +#region Event Handlers private void OkButton_Click( object sender, RoutedEventArgs e ) { _collectionControl.PersistChanges(); this.DialogResult = true; - Close(); + this.Close(); } private void CancelButton_Click( object sender, RoutedEventArgs e ) { + _collectionControl.PersistChanges( originalData ); this.DialogResult = false; - Close(); + this.Close(); + } + +#endregion //Event Hanlders + +#region Private Methods + + private object Clone( object source ) + { + var sourceType = source.GetType(); + //Get default constructor + var result = sourceType.GetConstructor( new Type[] { } ).Invoke( null ); + var properties = sourceType.GetProperties(); + + foreach( var propertyInfo in properties ) + { + var propertyInfoValue = propertyInfo.GetValue( source, null ); + + if( propertyInfo.CanWrite ) + { + //Look for nested object + if( propertyInfo.PropertyType.IsClass && (propertyInfo.PropertyType != typeof(Transform)) && !propertyInfo.PropertyType.Equals( typeof( string ) ) ) + { + var nestedObject = this.Clone( propertyInfoValue ); + propertyInfo.SetValue( result, nestedObject, null ); + } + else + { + // copy object + propertyInfo.SetValue( result, propertyInfoValue, null ); + } + } + } + + return result; } - #endregion //Event Hanlders +#endregion } } diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/ColorPicker/Implementation/ColorPicker.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/ColorPicker/Implementation/ColorPicker.cs index 8e9e560e..028814e8 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/ColorPicker/Implementation/ColorPicker.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/ColorPicker/Implementation/ColorPicker.cs @@ -208,7 +208,7 @@ namespace Xceed.Wpf.Toolkit #region IsOpen - public static readonly DependencyProperty IsOpenProperty = DependencyProperty.Register( "IsOpen", typeof( bool ), typeof( ColorPicker ), new UIPropertyMetadata( false ) ); + public static readonly DependencyProperty IsOpenProperty = DependencyProperty.Register( "IsOpen", typeof( bool ), typeof( ColorPicker ), new UIPropertyMetadata( false, OnIsOpenChanged ) ); public bool IsOpen { get @@ -221,6 +221,19 @@ namespace Xceed.Wpf.Toolkit } } + private static void OnIsOpenChanged( DependencyObject d, DependencyPropertyChangedEventArgs e ) + { + ColorPicker colorPicker = (ColorPicker)d; + if( colorPicker != null ) + colorPicker.OnIsOpenChanged( (bool)e.OldValue, (bool)e.NewValue ); + } + + private void OnIsOpenChanged( bool oldValue, bool newValue ) + { + RoutedEventArgs args = new RoutedEventArgs( newValue ? OpenedEvent : ClosedEvent, this ); + this.RaiseEvent( args ); + } + #endregion //IsOpen #region RecentColors @@ -629,6 +642,8 @@ namespace Xceed.Wpf.Toolkit #region Events + #region SelectedColorChangedEvent + public static readonly RoutedEvent SelectedColorChangedEvent = EventManager.RegisterRoutedEvent( "SelectedColorChanged", RoutingStrategy.Bubble, typeof( RoutedPropertyChangedEventHandler ), typeof( ColorPicker ) ); public event RoutedPropertyChangedEventHandler SelectedColorChanged { @@ -642,6 +657,42 @@ namespace Xceed.Wpf.Toolkit } } + #endregion + + #region OpenedEvent + + public static readonly RoutedEvent OpenedEvent = EventManager.RegisterRoutedEvent( "OpenedEvent", RoutingStrategy.Bubble, typeof( RoutedEventHandler ), typeof( ColorPicker ) ); + public event RoutedEventHandler Opened + { + add + { + AddHandler( OpenedEvent, value ); + } + remove + { + RemoveHandler( OpenedEvent, value ); + } + } + + #endregion //OpenedEvent + + #region ClosedEvent + + public static readonly RoutedEvent ClosedEvent = EventManager.RegisterRoutedEvent( "ClosedEvent", RoutingStrategy.Bubble, typeof( RoutedEventHandler ), typeof( ColorPicker ) ); + public event RoutedEventHandler Closed + { + add + { + AddHandler( ClosedEvent, value ); + } + remove + { + RemoveHandler( ClosedEvent, value ); + } + } + + #endregion //ClosedEvent + #endregion //Events #region Methods diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Aero2.NormalColor.xaml index 30072651..d758a3c5 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/ColorPicker/Themes/Aero2.NormalColor.xaml @@ -286,7 +286,19 @@ Focusable="False" HorizontalOffset="1" VerticalOffset="1" - PopupAnimation="Slide"> + PopupAnimation="Slide" + ToolTip="{x:Static sys:String.Empty}"> + + + - + + + + diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Core/Converters/NullToBoolConverter.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Core/Converters/NullToBoolConverter.cs new file mode 100644 index 00000000..75650e12 --- /dev/null +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Core/Converters/NullToBoolConverter.cs @@ -0,0 +1,35 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 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 + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Xceed.Wpf.Toolkit.Core.Converters +{ + public class NullToBoolConverter : IValueConverter + { + public object Convert( object value, Type targetType, object parameter, CultureInfo culture ) + { + return (value == null); + } + + public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture ) + { + throw new NotImplementedException(); + } + } +} diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Core/Utilities/CalculatorUtilities.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Core/Utilities/CalculatorUtilities.cs index 5cb08c58..346fce99 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Core/Utilities/CalculatorUtilities.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Core/Utilities/CalculatorUtilities.cs @@ -234,7 +234,9 @@ namespace Xceed.Wpf.Toolkit.Core.Utilities public static decimal ParseDecimal( string text ) { - return Decimal.Parse( text, CultureInfo.CurrentCulture ); + decimal result; + var success = Decimal.TryParse( text, NumberStyles.Any, CultureInfo.CurrentCulture, out result ); + return success ? result : decimal.Zero; } public static decimal Add( decimal firstNumber, decimal secondNumber ) diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/DateTimePicker/Implementation/DateTimePicker.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/DateTimePicker/Implementation/DateTimePicker.cs index 7c28f129..a64a9d47 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/DateTimePicker/Implementation/DateTimePicker.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/DateTimePicker/Implementation/DateTimePicker.cs @@ -63,6 +63,24 @@ namespace Xceed.Wpf.Toolkit #endregion //AutoCloseCalendar + #region CalendarDisplayMode + + public static readonly DependencyProperty CalendarDisplayModeProperty = DependencyProperty.Register( "CalendarDisplayMode", typeof( CalendarMode ) + , typeof( DateTimePicker ), new UIPropertyMetadata( CalendarMode.Month ) ); + public CalendarMode CalendarDisplayMode + { + get + { + return (CalendarMode)GetValue( CalendarDisplayModeProperty ); + } + set + { + SetValue( CalendarDisplayModeProperty, value ); + } + } + + #endregion //CalendarDisplayMode + #region TimeFormat public static readonly DependencyProperty TimeFormatProperty = DependencyProperty.Register( "TimeFormat", typeof( DateTimeFormat ), typeof( DateTimePicker ), new UIPropertyMetadata( DateTimeFormat.ShortTime ) ); diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Aero2.NormalColor.xaml index e4325807..db011f3a 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/DateTimePicker/Themes/Aero2.NormalColor.xaml @@ -114,6 +114,7 @@ HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsUndoEnabled="{Binding IsUndoEnabled, RelativeSource={RelativeSource TemplatedParent}}" + IsTabStop="{TemplateBinding IsTabStop}" MinWidth="20" AcceptsReturn="False" Padding="{TemplateBinding Padding}" @@ -137,7 +138,7 @@ - + - + + xmlns:local="clr-namespace:Xceed.Wpf.Toolkit" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -104,7 +105,19 @@ StaysOpen="False" Placement="Bottom" Focusable="False" - IsOpen="{Binding IsChecked, ElementName=PART_DropDownButton}"> + IsOpen="{Binding IsChecked, ElementName=PART_DropDownButton}" + ToolTip="{x:Static sys:String.Empty}"> + + + + xmlns:local="clr-namespace:Xceed.Wpf.Toolkit" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -122,7 +123,19 @@ StaysOpen="False" Placement="Bottom" Focusable="False" - IsOpen="{Binding IsChecked, ElementName=PART_DropDownButton}"> + IsOpen="{Binding IsChecked, ElementName=PART_DropDownButton}" + ToolTip="{x:Static sys:String.Empty}"> + + + = 0); + } + + private static void OnZoomFactorOnMouseWheelPropertyChanged( DependencyObject d, DependencyPropertyChangedEventArgs e ) + { + Magnifier m = (Magnifier)d; + m.OnZoomFactorOnMouseWheelChanged( e ); + } + + protected virtual void OnZoomFactorOnMouseWheelChanged( DependencyPropertyChangedEventArgs e ) + { + } + + #endregion //ZoomFactorOnMouseWheel + #endregion //Properties #region Constructors diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Magnifier/Implementation/MagnifierManager.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Magnifier/Implementation/MagnifierManager.cs index 2af25cbf..6c66bac1 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Magnifier/Implementation/MagnifierManager.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Magnifier/Implementation/MagnifierManager.cs @@ -57,25 +57,53 @@ namespace Xceed.Wpf.Toolkit #region Event Handlers - void Element_MouseLeave( object sender, MouseEventArgs e ) + private void Element_MouseLeave( object sender, MouseEventArgs e ) { HideAdorner(); } - void Element_MouseEnter( object sender, MouseEventArgs e ) + private void Element_MouseEnter( object sender, MouseEventArgs e ) { ShowAdorner(); } - #endregion //Event Handlers + private void Element_MouseWheel( object sender, MouseWheelEventArgs e ) + { + var magnifier = MagnifierManager.GetMagnifier( _element ) as Magnifier; + if( (magnifier != null) && magnifier.IsUsingZoomOnMouseWheel ) + { + if( e.Delta < 0 ) + { + var newValue = magnifier.ZoomFactor + magnifier.ZoomFactorOnMouseWheel; +#if VS2008 + magnifier.ZoomFactor = newValue; +#else + magnifier.SetCurrentValue( Magnifier.ZoomFactorProperty, newValue ); +#endif + } + else if ( e.Delta > 0 ) + { + var newValue = (magnifier.ZoomFactor >= magnifier.ZoomFactorOnMouseWheel) ? magnifier.ZoomFactor - magnifier.ZoomFactorOnMouseWheel : 0d; +#if VS2008 + magnifier.ZoomFactor = newValue; +#else + magnifier.SetCurrentValue( Magnifier.ZoomFactorProperty, newValue ); +#endif + } + _adorner.UpdateViewBox(); + } + } + +#endregion //Event Handlers - #region Methods +#region Methods private void AttachToMagnifier( UIElement element, Magnifier magnifier ) { _element = element; _element.MouseEnter += Element_MouseEnter; _element.MouseLeave += Element_MouseLeave; + _element.MouseWheel += Element_MouseWheel; magnifier.Target = _element; @@ -109,6 +137,6 @@ namespace Xceed.Wpf.Toolkit } } - #endregion //Methods +#endregion //Methods } } diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Aero2.NormalColor.xaml index 7e672b5b..93dd7f8a 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Aero2.NormalColor.xaml @@ -19,7 +19,8 @@ xmlns:local="clr-namespace:Xceed.Wpf.Toolkit" xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes" xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes" - xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"> + xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -145,7 +146,19 @@ Focusable="False" PopupAnimation="Slide" Width="{TemplateBinding DropDownWidth}" - Height="{TemplateBinding DropDownHeight}"> + Height="{TemplateBinding DropDownHeight}" + ToolTip="{x:Static sys:String.Empty}"> + + + diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Generic.xaml b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Generic.xaml index 97b07451..8454e72e 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Generic.xaml @@ -18,7 +18,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Xceed.Wpf.Toolkit" xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes" - xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"> + xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -132,7 +133,19 @@ Focusable="False" PopupAnimation="Slide" Width="{TemplateBinding DropDownWidth}" - Height="{TemplateBinding DropDownHeight}"> + Height="{TemplateBinding DropDownHeight}" + ToolTip="{x:Static sys:String.Empty}"> + + + ), new UIPropertyMetadata( DateTimePart.Other, OnCurrentDateTimePartChanged ) ); + public DateTimePart CurrentDateTimePart + { + get + { + return (DateTimePart)GetValue( CurrentDateTimePartProperty ); + } + set + { + SetValue( CurrentDateTimePartProperty, value ); + } + } + + private static void OnCurrentDateTimePartChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + DateTimeUpDownBase dateTimeUpDownBase = o as DateTimeUpDownBase; + if( dateTimeUpDownBase != null ) + dateTimeUpDownBase.OnCurrentDateTimePartChanged( (DateTimePart)e.OldValue, (DateTimePart)e.NewValue ); + } + + protected virtual void OnCurrentDateTimePartChanged( DateTimePart oldValue, DateTimePart newValue ) + { + this.Select( this.GetDateTimeInfo( newValue ) ); + } + + #endregion //CurrentDateTimePart + + #region Step + + public static readonly DependencyProperty StepProperty = DependencyProperty.Register( "Step", typeof( int ) + , typeof( DateTimeUpDownBase ), new UIPropertyMetadata( 1, OnStepChanged ) ); + public int Step + { + get + { + return (int)GetValue( StepProperty ); + } + set + { + SetValue( StepProperty, value ); + } + } + + private static void OnStepChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + var dateTimeUpDownBase = o as DateTimeUpDownBase; + if( dateTimeUpDownBase != null ) + dateTimeUpDownBase.OnStepChanged( (int)e.OldValue, (int)e.NewValue ); + } + + protected virtual void OnStepChanged( int oldValue, int newValue ) + { + } + + #endregion //Step + + #endregion + #region Constructors internal DateTimeUpDownBase() { this.InitializeDateTimeInfoList(); + this.Loaded += this.DateTimeUpDownBase_Loaded; } #endregion @@ -51,7 +115,6 @@ namespace Xceed.Wpf.Toolkit.Primitives { if( this.TextBox != null ) { - this.TextBox.GotFocus -= new RoutedEventHandler( this.TextBox_GotFocus ); this.TextBox.SelectionChanged -= this.TextBox_SelectionChanged; } @@ -59,7 +122,6 @@ namespace Xceed.Wpf.Toolkit.Primitives if( this.TextBox != null ) { - this.TextBox.GotFocus += new RoutedEventHandler( this.TextBox_GotFocus ); this.TextBox.SelectionChanged += this.TextBox_SelectionChanged; } } @@ -150,12 +212,9 @@ namespace Xceed.Wpf.Toolkit.Primitives _fireSelectionChangedEvent = true; } - private void TextBox_GotFocus( object sender, RoutedEventArgs e ) + private void DateTimeUpDownBase_Loaded( object sender, RoutedEventArgs e ) { - if( _selectedDateTimeInfo == null ) - { - this.Select( this.GetDateTimeInfo( 0 ) ); - } + this.InitSelection(); } #endregion @@ -192,14 +251,24 @@ namespace Xceed.Wpf.Toolkit.Primitives ( info.StartPosition <= selectionStart ) && ( selectionStart < ( info.StartPosition + info.Length ) ) ); } + internal DateTimeInfo GetDateTimeInfo( DateTimePart part ) + { + return _dateTimeInfoList.FirstOrDefault( ( info ) =>info.Type == part ); + } + internal void Select( DateTimeInfo info ) { - if( info != null ) + if( (info != null) && !info.Equals( _selectedDateTimeInfo ) && ( this.TextBox != null) && !string.IsNullOrEmpty( this.TextBox.Text ) ) { _fireSelectionChangedEvent = false; this.TextBox.Select( info.StartPosition, info.Length ); _fireSelectionChangedEvent = true; _selectedDateTimeInfo = info; +#if VS2008 + this.CurrentDateTimePart = info.Type; +#else + this.SetCurrentValue( DateTimeUpDownBase.CurrentDateTimePartProperty, info.Type ); +#endif } } @@ -301,6 +370,14 @@ namespace Xceed.Wpf.Toolkit.Primitives return previousDateTimeInfo; } + private void InitSelection() + { + if( _selectedDateTimeInfo == null ) + { + this.Select( (this.CurrentDateTimePart != DateTimePart.Other) ? this.GetDateTimeInfo( this.CurrentDateTimePart ) : this.GetDateTimeInfo( 0 ) ); + } + } + #endregion } } diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Aero2/WindowControl.xaml b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Aero2/WindowControl.xaml index 5e1f3f58..ca8e0845 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Aero2/WindowControl.xaml +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Aero2/WindowControl.xaml @@ -25,7 +25,7 @@ - 8 + 5 @@ -65,7 +65,7 @@ - + diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Generic/WindowControl.xaml b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Generic/WindowControl.xaml index 41d6cfe9..68f62ec4 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Generic/WindowControl.xaml +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Primitives/Themes/Generic/WindowControl.xaml @@ -25,7 +25,7 @@ - 8 + 5 @@ -67,7 +67,7 @@ - + diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Primitives/UpDownBase.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Primitives/UpDownBase.cs index 2b899dd4..5259cee9 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Primitives/UpDownBase.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Primitives/UpDownBase.cs @@ -566,6 +566,8 @@ namespace Xceed.Wpf.Toolkit.Primitives public event InputValidationErrorEventHandler InputValidationError; + public event EventHandler Spinned; + #region ValueChanged Event //Due to a bug in Visual Studio, you cannot create event handlers for generic T args in XAML, so I have to use object instead. @@ -593,6 +595,13 @@ namespace Xceed.Wpf.Toolkit.Primitives if( e == null ) throw new ArgumentNullException( "e" ); + // Raise the Spinned event to user + EventHandler handler = this.Spinned; + if( handler != null ) + { + handler( this, e ); + } + if( e.Direction == SpinDirection.Increase ) DoIncrement(); else diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/CategoryGroupStyleSelector.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/CategoryGroupStyleSelector.cs new file mode 100644 index 00000000..80af7896 --- /dev/null +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/CategoryGroupStyleSelector.cs @@ -0,0 +1,65 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 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 + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System.ComponentModel; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Media; + +namespace Xceed.Wpf.Toolkit.PropertyGrid +{ + public class CategoryGroupStyleSelector : StyleSelector + { + public Style SingleDefaultCategoryItemGroupStyle + { + get; + set; + } + public Style ItemGroupStyle + { + get; + set; + } + + public override Style SelectStyle( object item, DependencyObject container ) + { + var group = item as CollectionViewGroup; + // Category is not "Misc" => use regular ItemGroupStyle + if( !group.Name.Equals( CategoryAttribute.Default.Category ) ) + return this.ItemGroupStyle; + + // Category is "Misc" + while( container != null ) + { + container = VisualTreeHelper.GetParent( container ); + if( container is ItemsControl ) + break; + } + + var itemsControl = container as ItemsControl; + if( itemsControl != null ) + { + // Category is "Misc" and this is the only category => use SingleDefaultCategoryItemGroupContainerStyle + if( (itemsControl.Items.Count > 0) && (itemsControl.Items.Groups.Count == 1) ) + return this.SingleDefaultCategoryItemGroupStyle; + } + + // Category is "Misc" and this is NOT the only category => use regular ItemGroupStyle + return this.ItemGroupStyle; + } + } +} diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs index 1fcc68c1..edc107e8 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinition.cs @@ -101,7 +101,7 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid //Bind the value property with the source object. var binding = new Binding( PropertyDescriptor.Name ) { - Source = SelectedObject, + Source = this.GetValueInstance( SelectedObject ), Mode = PropertyDescriptor.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay, ValidatesOnDataErrors = true, ValidatesOnExceptions = true, diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinitionBase.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinitionBase.cs index ee8cdb3e..fd703cb4 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinitionBase.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/DescriptorPropertyDefinitionBase.cs @@ -152,15 +152,12 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid bool isResource = false; bool isDynamicResource = false; - var markupProperty = markupObject.Properties.Where( p => p.Name == PropertyName ).FirstOrDefault(); - if( ( markupProperty != null ) - && ( markupProperty.PropertyType != typeof( object ) ) - && !markupProperty.PropertyType.IsEnum - && !markupProperty.PropertyType.IsArray ) - { - //TODO: need to find a better way to determine if a StaticResource has been applied to any property not just a style - isResource = ( markupProperty.Value is Style ); - isDynamicResource = ( markupProperty.Value is DynamicResourceExtension ); + var markupProperty = markupObject.Properties.FirstOrDefault( p => p.Name == PropertyName ); + if( markupProperty != null ) + { + //TODO: need to find a better way to determine if a StaticResource has been applied to any property not just a style(maybe with StaticResourceExtension) + isResource = typeof( Style ).IsAssignableFrom( markupProperty.PropertyType ); + isDynamicResource = typeof( DynamicResourceExtension ).IsAssignableFrom( markupProperty.PropertyType ); } if( isResource || isDynamicResource ) @@ -293,6 +290,15 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid return this.ComputeDisplayOrder( isPropertyGridCategorized ); } + internal object GetValueInstance( object sourceObject ) + { + ICustomTypeDescriptor customTypeDescriptor = sourceObject as ICustomTypeDescriptor; + if( customTypeDescriptor != null ) + sourceObject = customTypeDescriptor.GetPropertyOwner( PropertyDescriptor ); + + return sourceObject; + } + #endregion #region Private Methods diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/FontComboBoxEditor.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/FontComboBoxEditor.cs index ffefd454..be62f2c6 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/FontComboBoxEditor.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/FontComboBoxEditor.cs @@ -28,7 +28,7 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid.Editors protected override IEnumerable CreateItemsSource( PropertyItem propertyItem ) { if( propertyItem.PropertyType == typeof( FontFamily ) ) - return FontUtilities.Families; + return FontUtilities.Families.OrderBy( x => x.Source); else if( propertyItem.PropertyType == typeof( FontWeight ) ) return FontUtilities.Weights; else if( propertyItem.PropertyType == typeof( FontStyle ) ) diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/IPropertyContainer.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/IPropertyContainer.cs index 465ff068..2f8c3ace 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/IPropertyContainer.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/IPropertyContainer.cs @@ -49,5 +49,7 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid bool HideInheritedProperties { get; } FilterInfo FilterInfo { get; } + + bool? IsPropertyVisible( PropertyDescriptor pd ); } } diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelper.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelper.cs index 15e83471..fd54ce5e 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelper.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelper.cs @@ -59,11 +59,22 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid foreach( var descriptor in descriptors ) { var propertyDef = this.GetPropertyDefinition( descriptor ); - bool isBrowsable = descriptor.IsBrowsable && this.PropertyContainer.AutoGenerateProperties; - if( propertyDef != null ) + bool isBrowsable = false; + + var isPropertyBrowsable = this.PropertyContainer.IsPropertyVisible( descriptor ); + if( isPropertyBrowsable.HasValue ) + { + isBrowsable = isPropertyBrowsable.Value; + } + else { - isBrowsable = propertyDef.IsBrowsable.GetValueOrDefault( isBrowsable ); + isBrowsable = descriptor.IsBrowsable && this.PropertyContainer.AutoGenerateProperties; + if( propertyDef != null ) + { + isBrowsable = propertyDef.IsBrowsable.GetValueOrDefault( isBrowsable ); + } } + if( isBrowsable ) { var prop = this.CreatePropertyItem( descriptor, propertyDef ); diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs index 16106b33..76d083fd 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/ObjectContainerHelperBase.cs @@ -258,9 +258,20 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid if( tc == null || !tc.GetPropertiesSupported() ) { if( instance is ICustomTypeDescriptor ) - descriptors = ( ( ICustomTypeDescriptor )instance ).GetProperties(); + { + descriptors = ((ICustomTypeDescriptor)instance).GetProperties(); + } + //ICustomTypeProvider is only available in .net 4.5 and over. Use reflection so the .net 4.0 and .net 3.5 still works. + else if( instance.GetType().GetInterface( "ICustomTypeProvider", true ) != null ) + { + var methodInfo = instance.GetType().GetMethod( "GetCustomType" ); + var result = methodInfo.Invoke( instance, null ) as Type; + descriptors = TypeDescriptor.GetProperties( result ); + } else + { descriptors = TypeDescriptor.GetProperties( instance.GetType() ); + } } else { diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyGrid.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyGrid.cs index ed840253..c61909fc 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyGrid.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyGrid.cs @@ -1071,6 +1071,12 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid #endregion + #region IsPropertyBrowsable Event + + public event IsPropertyBrowsableHandler IsPropertyBrowsable; + + #endregion + #region PreparePropertyItemEvent Attached Routed Event /// @@ -1234,6 +1240,21 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid } + bool? IPropertyContainer.IsPropertyVisible( PropertyDescriptor pd ) + { + var handler = this.IsPropertyBrowsable; + //If anyone is registered to PropertyGrid.IsPropertyBrowsable event + if( handler != null ) + { + var isBrowsableArgs = new IsPropertyBrowsableArgs( pd ); + handler( this, isBrowsableArgs ); + + return isBrowsableArgs.IsBrowsable; + } + + return null; + } + #endregion @@ -1290,4 +1311,54 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid } #endregion + #region isPropertyBrowsableEvent Handler/Args + + public delegate void IsPropertyBrowsableHandler( object sender, IsPropertyBrowsableArgs e ); + + public class IsPropertyBrowsableArgs : RoutedEventArgs + { + #region Constructors + + public IsPropertyBrowsableArgs( PropertyDescriptor pd ) + { + this.PropertyDescriptor = pd; + } + + #endregion + + #region Properties + + #region IsBrowsable Property + + public bool IsBrowsable + { + get + { + return _isBrowsable; + } + set + { + _isBrowsable = value; + } + } + + private bool _isBrowsable = true; + + #endregion + + #region PropertyDescriptor Property + + public PropertyDescriptor PropertyDescriptor + { + get; + private set; + } + + #endregion + + #endregion + } + + #endregion + } diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyItemBase.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyItemBase.cs index 10e6d317..fabcd7c0 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyItemBase.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Implementation/PropertyItemBase.cs @@ -498,6 +498,16 @@ namespace Xceed.Wpf.Toolkit.PropertyGrid get { return new FilterInfo(); } } + bool? IPropertyContainer.IsPropertyVisible( PropertyDescriptor pd ) + { + if( _parentNode != null ) + { + return _parentNode.IsPropertyVisible( pd ); + } + + return null; + } + #endregion } diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml index 0b850d1f..4126a1ef 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml @@ -26,164 +26,213 @@ xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes" xmlns:sys="clr-namespace:System;assembly=mscorlib"> - - - - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - @@ -215,27 +270,32 @@ - - - - - - @@ -311,210 +391,352 @@ - - - + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml index a1dab8ec..a34618d1 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml @@ -41,10 +41,12 @@ + + @@ -880,7 +882,7 @@ - + @@ -889,6 +891,18 @@ + + @@ -896,6 +910,11 @@ Command="commands:PropertyItemCommands.ResetValue" /> + + + + + xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> @@ -144,6 +145,7 @@ HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsUndoEnabled="{Binding IsUndoEnabled, RelativeSource={RelativeSource TemplatedParent}}" + IsTabStop="{TemplateBinding IsTabStop}" MinWidth="20" AcceptsReturn="False" Padding="{TemplateBinding Padding}" @@ -166,7 +168,19 @@ + StaysOpen="False" + ToolTip="{x:Static sys:String.Empty}"> + + + = 0 ) ) ? info.StartPosition + 1 : info.StartPosition; + int startPos = (this.GetDateTimeInfo( info.Type ) != null) ? this.GetDateTimeInfo( info.Type ).StartPosition : info.StartPosition; + if( result.HasValue && (result.Value.TotalMilliseconds < 0) && oldValue.HasValue && (oldValue.Value.TotalMilliseconds >= 0) ) + { + startPos += 1; + } this.TextBox.Select( startPos, info.Length ); _fireSelectionChangedEvent = true; } diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Aero2.NormalColor.xaml b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Aero2.NormalColor.xaml index fed46ddc..4e1d4c9e 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Aero2.NormalColor.xaml +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Aero2.NormalColor.xaml @@ -47,7 +47,9 @@ Value="Center" /> - + @@ -77,6 +79,7 @@ HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsUndoEnabled="{Binding IsUndoEnabled, RelativeSource={RelativeSource TemplatedParent}}" + IsTabStop="{TemplateBinding IsTabStop}" MinWidth="20" AcceptsReturn="False" Padding="{TemplateBinding Padding}" diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Generic.xaml b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Generic.xaml index 8594f120..f8d8fe3d 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/TimeSpanUpDown/Themes/Generic.xaml @@ -50,6 +50,8 @@ Value="{StaticResource DefaultWatermarkTemplate}" /> + @@ -76,6 +78,7 @@ HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsUndoEnabled="{Binding IsUndoEnabled, RelativeSource={RelativeSource TemplatedParent}}" + IsTabStop="{TemplateBinding IsTabStop}" MinWidth="20" AcceptsReturn="False" Padding="{TemplateBinding Padding}" diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj index 4a8fddd3..890c6c11 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Xceed.Wpf.Toolkit.csproj @@ -416,9 +416,11 @@ + + diff --git a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Zoombox/Zoombox.cs b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Zoombox/Zoombox.cs index 561f09dd..c086aa25 100644 --- a/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Zoombox/Zoombox.cs +++ b/ExtendedWPFToolkitSolution_35/Src/Xceed.Wpf.Toolkit/Zoombox/Zoombox.cs @@ -1600,6 +1600,8 @@ namespace Xceed.Wpf.Toolkit.Zoombox #endregion + public event EventHandler Scroll; + #region ViewStackIndexChanged Event public static readonly RoutedEvent ViewStackIndexChangedEvent = EventManager.RegisterRoutedEvent( "ViewStackIndexChanged", RoutingStrategy.Bubble, typeof( IndexChangedEventHandler ), typeof( Zoombox ) ); @@ -2275,12 +2277,26 @@ namespace Xceed.Wpf.Toolkit.Zoombox { double diff = e.NewValue + _relativePosition.Y; this.OnDrag( new DragDeltaEventArgs( 0d, -diff / this.Scale ), false ); + + // Raise the Scroll event to user + EventHandler handler = this.Scroll; + if( handler != null ) + { + handler( this, e ); + } } private void HorizontalScrollBar_Scroll( object sender, ScrollEventArgs e ) { double diff = e.NewValue + _relativePosition.X; this.OnDrag( new DragDeltaEventArgs( -diff / this.Scale, 0d ), false ); + + // Raise the Scroll event to user + EventHandler handler = this.Scroll; + if( handler != null ) + { + handler( this, e ); + } } private void DragDisplayViewport( DragDeltaEventArgs e, bool end )