433 changed files with 40598 additions and 19462 deletions
@ -0,0 +1,87 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class ConnectionErrorChangedEventManager : WeakEventManager |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
private ConnectionErrorChangedEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region CurrentManager Private Property
|
||||
|
|
||||
|
private static ConnectionErrorChangedEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( ConnectionErrorChangedEventManager ); |
||||
|
var currentManager = ( ConnectionErrorChangedEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new ConnectionErrorChangedEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public static void AddListener( DataGridVirtualizingCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( DataGridVirtualizingCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridVirtualizingCollectionViewBase )source; |
||||
|
target.ConnectionErrorChanged += new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridVirtualizingCollectionViewBase )source; |
||||
|
target.ConnectionErrorChanged -= new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,87 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class ConnectionStateChangedEventManager : WeakEventManager |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
private ConnectionStateChangedEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region CurrentManager Private Property
|
||||
|
|
||||
|
private static ConnectionStateChangedEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( ConnectionStateChangedEventManager ); |
||||
|
var currentManager = ( ConnectionStateChangedEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new ConnectionStateChangedEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public static void AddListener( DataGridVirtualizingCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( DataGridVirtualizingCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridVirtualizingCollectionViewBase )source; |
||||
|
target.ConnectionStateChanged += new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridVirtualizingCollectionViewBase )source; |
||||
|
target.ConnectionStateChanged -= new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,87 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class DistinctValuesRefreshNeededEventManager : WeakEventManager |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
private DistinctValuesRefreshNeededEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region CurrentManager Private Property
|
||||
|
|
||||
|
private static DistinctValuesRefreshNeededEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( DistinctValuesRefreshNeededEventManager ); |
||||
|
var currentManager = ( DistinctValuesRefreshNeededEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new DistinctValuesRefreshNeededEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public static void AddListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionViewBase )source; |
||||
|
target.DistinctValuesRefreshNeeded += new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionViewBase )source; |
||||
|
target.DistinctValuesRefreshNeeded -= new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,92 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class ItemPropertyGroupSortStatNameChangedEventManager : WeakEventManager |
||||
|
{ |
||||
|
private ItemPropertyGroupSortStatNameChangedEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#region CurrentManager Private Property
|
||||
|
|
||||
|
private static ItemPropertyGroupSortStatNameChangedEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( ItemPropertyGroupSortStatNameChangedEventManager ); |
||||
|
var currentManager = WeakEventManager.GetCurrentManager( managerType ) as ItemPropertyGroupSortStatNameChangedEventManager; |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new ItemPropertyGroupSortStatNameChangedEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public static void AddListener( DataGridItemPropertyCollection source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( DataGridItemPropertyCollection source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var target = source as DataGridItemPropertyCollection; |
||||
|
//target.ItemPropertyGroupSortStatNameChanged += new EventHandler( this.DeliverEvent );
|
||||
|
target.ItemPropertyGroupSortStatNameChanged += target_ItemPropertyGroupSortStatNameChanged; |
||||
|
} |
||||
|
|
||||
|
void target_ItemPropertyGroupSortStatNameChanged( object sender, EventArgs e ) |
||||
|
{ |
||||
|
this.DeliverEvent( sender, e ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var target = source as DataGridItemPropertyCollection; |
||||
|
target.ItemPropertyGroupSortStatNameChanged -= new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,78 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class PostBatchCollectionChangedEventManager : WeakEventManager |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
private PostBatchCollectionChangedEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region CurrentManager Static Property
|
||||
|
|
||||
|
private static PostBatchCollectionChangedEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( PostBatchCollectionChangedEventManager ); |
||||
|
var currentManager = ( PostBatchCollectionChangedEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new PostBatchCollectionChangedEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public static void AddListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
PostBatchCollectionChangedEventManager.CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
PostBatchCollectionChangedEventManager.CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
( ( DataGridCollectionViewBase )source ).PostBatchCollectionChanged += new EventHandler( this.OnEventRaised ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
( ( DataGridCollectionViewBase )source ).PostBatchCollectionChanged -= new EventHandler( this.OnEventRaised ); |
||||
|
} |
||||
|
|
||||
|
private void OnEventRaised( object sender, EventArgs e ) |
||||
|
{ |
||||
|
this.DeliverEvent( sender, e ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,78 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class PreBatchCollectionChangedEventManager : WeakEventManager |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
private PreBatchCollectionChangedEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region CurrentManager Static Property
|
||||
|
|
||||
|
private static PreBatchCollectionChangedEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( PreBatchCollectionChangedEventManager ); |
||||
|
var currentManager = ( PreBatchCollectionChangedEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new PreBatchCollectionChangedEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public static void AddListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
PreBatchCollectionChangedEventManager.CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
PreBatchCollectionChangedEventManager.CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
( ( DataGridCollectionViewBase )source ).PreBatchCollectionChanged += new EventHandler( this.OnEventRaised ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
( ( DataGridCollectionViewBase )source ).PreBatchCollectionChanged -= new EventHandler( this.OnEventRaised ); |
||||
|
} |
||||
|
|
||||
|
private void OnEventRaised( object sender, EventArgs e ) |
||||
|
{ |
||||
|
this.DeliverEvent( sender, e ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,87 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class ProxyApplyingFilterCriteriasEventManager : WeakEventManager |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
private ProxyApplyingFilterCriteriasEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region CurrentManager Private Property
|
||||
|
|
||||
|
private static ProxyApplyingFilterCriteriasEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( ProxyApplyingFilterCriteriasEventManager ); |
||||
|
var currentManager = ( ProxyApplyingFilterCriteriasEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new ProxyApplyingFilterCriteriasEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public static void AddListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionViewBase )source; |
||||
|
target.ProxyApplyingFilterCriterias += new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionViewBase )source; |
||||
|
target.ProxyApplyingFilterCriterias -= new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,93 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Collections.Specialized; |
||||
|
using System.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class ProxyAutoFilterValuesChangedEventManager : WeakEventManager |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
private ProxyAutoFilterValuesChangedEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region CurrentManager Private Property
|
||||
|
|
||||
|
private static ProxyAutoFilterValuesChangedEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( ProxyAutoFilterValuesChangedEventManager ); |
||||
|
var currentManager = ( ProxyAutoFilterValuesChangedEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new ProxyAutoFilterValuesChangedEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public static void AddListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionViewBase )source; |
||||
|
target.ProxyAutoFilterValuesChanged += new NotifyCollectionChangedEventHandler( this.OnEventRaised ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionViewBase )source; |
||||
|
target.ProxyAutoFilterValuesChanged -= new NotifyCollectionChangedEventHandler( this.OnEventRaised ); |
||||
|
} |
||||
|
|
||||
|
private void OnEventRaised( object sender, NotifyCollectionChangedEventArgs e ) |
||||
|
{ |
||||
|
this.DeliverEvent( sender, e ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,87 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class ProxyCollectionRefreshEventManager : WeakEventManager |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
private ProxyCollectionRefreshEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region CurrentManager Private Property
|
||||
|
|
||||
|
private static ProxyCollectionRefreshEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( ProxyCollectionRefreshEventManager ); |
||||
|
var currentManager = ( ProxyCollectionRefreshEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new ProxyCollectionRefreshEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public static void AddListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionViewBase )source; |
||||
|
target.ProxyCollectionRefresh += new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionViewBase )source; |
||||
|
target.ProxyCollectionRefresh -= new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,93 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Collections.Specialized; |
||||
|
using System.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class ProxyGroupDescriptionsChangedEventManager : WeakEventManager |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
private ProxyGroupDescriptionsChangedEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region CurrentManager Private Property
|
||||
|
|
||||
|
private static ProxyGroupDescriptionsChangedEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( ProxyGroupDescriptionsChangedEventManager ); |
||||
|
var currentManager = ( ProxyGroupDescriptionsChangedEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new ProxyGroupDescriptionsChangedEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public static void AddListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionViewBase )source; |
||||
|
target.ProxyGroupDescriptionsChanged += new NotifyCollectionChangedEventHandler( this.OnEventRaised ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionViewBase )source; |
||||
|
target.ProxyGroupDescriptionsChanged -= new NotifyCollectionChangedEventHandler( this.OnEventRaised ); |
||||
|
} |
||||
|
|
||||
|
private void OnEventRaised( object sender, NotifyCollectionChangedEventArgs e ) |
||||
|
{ |
||||
|
this.DeliverEvent( sender, e ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,93 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Collections.Specialized; |
||||
|
using System.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class ProxySortDescriptionsChangedEventManager : WeakEventManager |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
private ProxySortDescriptionsChangedEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region CurrentManager Private Property
|
||||
|
|
||||
|
private static ProxySortDescriptionsChangedEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( ProxySortDescriptionsChangedEventManager ); |
||||
|
var currentManager = ( ProxySortDescriptionsChangedEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new ProxySortDescriptionsChangedEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public static void AddListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( DataGridCollectionViewBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionViewBase )source; |
||||
|
target.ProxySortDescriptionsChanged += new NotifyCollectionChangedEventHandler( this.OnEventRaised ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionViewBase )source; |
||||
|
target.ProxySortDescriptionsChanged -= new NotifyCollectionChangedEventHandler( this.OnEventRaised ); |
||||
|
} |
||||
|
|
||||
|
private void OnEventRaised( object sender, NotifyCollectionChangedEventArgs e ) |
||||
|
{ |
||||
|
this.DeliverEvent( sender, e ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,145 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Collections.Generic; |
||||
|
using System.Diagnostics; |
||||
|
using System.Linq; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class RawItemMap |
||||
|
{ |
||||
|
#region [] Property
|
||||
|
|
||||
|
internal RawItem this[ object dataItem ] |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
Debug.Assert( dataItem != null ); |
||||
|
|
||||
|
RawItem value; |
||||
|
if( m_singleMap.TryGetValue( dataItem, out value ) ) |
||||
|
return value; |
||||
|
|
||||
|
RawItem[] values; |
||||
|
if( m_multiMap.TryGetValue( dataItem, out values ) ) |
||||
|
return values[ 0 ]; |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
internal void Add( object dataItem, RawItem rawItem ) |
||||
|
{ |
||||
|
Debug.Assert( dataItem != null ); |
||||
|
Debug.Assert( rawItem != null ); |
||||
|
Debug.Assert( dataItem == rawItem.DataItem ); |
||||
|
|
||||
|
RawItem single; |
||||
|
RawItem[] multiple; |
||||
|
|
||||
|
if( m_singleMap.TryGetValue( dataItem, out single ) ) |
||||
|
{ |
||||
|
Debug.Assert( rawItem != single, "It's not normal to be called twice for the same RawItem." ); |
||||
|
|
||||
|
m_multiMap.Add( dataItem, new RawItem[] { single, rawItem } ); |
||||
|
m_singleMap.Remove( dataItem ); |
||||
|
} |
||||
|
else if( m_multiMap.TryGetValue( dataItem, out multiple ) ) |
||||
|
{ |
||||
|
Debug.Assert( !multiple.Contains( rawItem ), "It's not normal to be called twice for the same RawItem." ); |
||||
|
|
||||
|
var length = multiple.Length; |
||||
|
|
||||
|
Array.Resize<RawItem>( ref multiple, length + 1 ); |
||||
|
multiple[ length ] = rawItem; |
||||
|
|
||||
|
m_multiMap[ dataItem ] = multiple; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
m_singleMap.Add( dataItem, rawItem ); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
internal void Remove( object dataItem, RawItem rawItem ) |
||||
|
{ |
||||
|
Debug.Assert( dataItem != null ); |
||||
|
Debug.Assert( rawItem != null ); |
||||
|
Debug.Assert( dataItem == rawItem.DataItem ); |
||||
|
|
||||
|
if( m_singleMap.Remove( dataItem ) ) |
||||
|
return; |
||||
|
|
||||
|
RawItem[] multiple; |
||||
|
if( !m_multiMap.TryGetValue( dataItem, out multiple ) ) |
||||
|
return; |
||||
|
|
||||
|
var length = multiple.Length; |
||||
|
if( length == 2 ) |
||||
|
{ |
||||
|
if( multiple[ 0 ] == rawItem ) |
||||
|
{ |
||||
|
m_singleMap.Add( dataItem, multiple[ 1 ] ); |
||||
|
m_multiMap.Remove( dataItem ); |
||||
|
} |
||||
|
else if( multiple[ 1 ] == rawItem ) |
||||
|
{ |
||||
|
m_singleMap.Add( dataItem, multiple[ 0 ] ); |
||||
|
m_multiMap.Remove( dataItem ); |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
Debug.Assert( length > 2 ); |
||||
|
|
||||
|
var index = Array.IndexOf( multiple, rawItem ); |
||||
|
if( index < 0 ) |
||||
|
return; |
||||
|
|
||||
|
RawItem[] copy = new RawItem[ length - 1 ]; |
||||
|
|
||||
|
if( index > 0 ) |
||||
|
{ |
||||
|
Array.Copy( multiple, 0, copy, 0, index ); |
||||
|
} |
||||
|
|
||||
|
if( index < length - 1 ) |
||||
|
{ |
||||
|
Array.Copy( multiple, index + 1, copy, index, length - index - 1 ); |
||||
|
} |
||||
|
|
||||
|
m_multiMap[ dataItem ] = copy; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
internal void Clear() |
||||
|
{ |
||||
|
m_singleMap.Clear(); |
||||
|
m_multiMap.Clear(); |
||||
|
} |
||||
|
|
||||
|
#region Private Fields
|
||||
|
|
||||
|
private readonly Dictionary<object, RawItem> m_singleMap = new Dictionary<object, RawItem>( 128 ); |
||||
|
private readonly Dictionary<object, RawItem[]> m_multiMap = new Dictionary<object, RawItem[]>( 0 ); |
||||
|
|
||||
|
#endregion
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,87 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class RootGroupChangedEventManager : WeakEventManager |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
private RootGroupChangedEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region CurrentManager Private Property
|
||||
|
|
||||
|
private static RootGroupChangedEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( RootGroupChangedEventManager ); |
||||
|
var currentManager = ( RootGroupChangedEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new RootGroupChangedEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public static void AddListener( DataGridCollectionView source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( DataGridCollectionView source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
if( source == null ) |
||||
|
throw new ArgumentNullException( "source" ); |
||||
|
|
||||
|
if( listener == null ) |
||||
|
throw new ArgumentNullException( "listener" ); |
||||
|
|
||||
|
CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionView )source; |
||||
|
target.RootGroupChanged += new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var target = ( DataGridCollectionView )source; |
||||
|
target.RootGroupChanged -= new EventHandler( this.DeliverEvent ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,109 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class DataItemDataProvider : DataItemDataProviderBase |
||||
|
{ |
||||
|
#region Static Fields
|
||||
|
|
||||
|
private static readonly object EmptyDataItem = new object(); |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region IsEmpty Property
|
||||
|
|
||||
|
public override bool IsEmpty |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return m_isEmpty; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void SetIsEmpty( bool value ) |
||||
|
{ |
||||
|
if( m_isEmpty == value ) |
||||
|
return; |
||||
|
|
||||
|
m_isEmpty = value; |
||||
|
|
||||
|
this.OnPropertyChanged( new PropertyChangedEventArgs( "IsEmpty" ) ); |
||||
|
} |
||||
|
|
||||
|
private bool m_isEmpty = true; |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public override void SetDataItem( object dataItem ) |
||||
|
{ |
||||
|
if( m_dataItem == dataItem ) |
||||
|
return; |
||||
|
|
||||
|
m_dataItem = dataItem; |
||||
|
|
||||
|
if( this.IsRefreshDeferred ) |
||||
|
return; |
||||
|
|
||||
|
this.Refresh(); |
||||
|
} |
||||
|
|
||||
|
public override void ClearDataItem() |
||||
|
{ |
||||
|
if( m_dataItem == DataItemDataProvider.EmptyDataItem ) |
||||
|
return; |
||||
|
|
||||
|
m_dataItem = DataItemDataProvider.EmptyDataItem; |
||||
|
|
||||
|
if( this.IsRefreshDeferred ) |
||||
|
return; |
||||
|
|
||||
|
this.Refresh(); |
||||
|
} |
||||
|
|
||||
|
protected override void BeginQuery() |
||||
|
{ |
||||
|
if( this.IsRefreshDeferred ) |
||||
|
return; |
||||
|
|
||||
|
base.BeginQuery(); |
||||
|
|
||||
|
if( m_dataItem == DataItemDataProvider.EmptyDataItem ) |
||||
|
{ |
||||
|
this.OnQueryFinished( null, null, this.OnDataChanged, true ); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
this.OnQueryFinished( m_dataItem, null, this.OnDataChanged, false ); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private object OnDataChanged( object arg ) |
||||
|
{ |
||||
|
this.SetIsEmpty( ( bool )arg ); |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
#region Private Fields
|
||||
|
|
||||
|
private object m_dataItem = DataItemDataProvider.EmptyDataItem; |
||||
|
|
||||
|
#endregion
|
||||
|
} |
||||
|
} |
||||
@ -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.Windows.Data; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal abstract class DataItemDataProviderBase : DataSourceProvider |
||||
|
{ |
||||
|
#region IsEmpty Property
|
||||
|
|
||||
|
public abstract bool IsEmpty |
||||
|
{ |
||||
|
get; |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public abstract void SetDataItem( object dataItem ); |
||||
|
public abstract void ClearDataItem(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,70 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Threading; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class EmptyDataItemDataProvider : DataItemDataProviderBase |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
private EmptyDataItemDataProvider() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region Instance Static Property
|
||||
|
|
||||
|
internal static EmptyDataItemDataProvider Instance |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
if( m_instance == null ) |
||||
|
{ |
||||
|
Interlocked.CompareExchange<EmptyDataItemDataProvider>( ref EmptyDataItemDataProvider.m_instance, new EmptyDataItemDataProvider(), null ); |
||||
|
} |
||||
|
|
||||
|
return m_instance; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private static EmptyDataItemDataProvider m_instance; |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region IsEmpty Property
|
||||
|
|
||||
|
public override bool IsEmpty |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public override void SetDataItem( object dataItem ) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public override void ClearDataItem() |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,72 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal class VisibilityChangingEventManager : WeakEventManager |
||||
|
{ |
||||
|
private VisibilityChangingEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public static void AddListener( ColumnCollection source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( ColumnCollection source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var columnCollection = ( ColumnCollection )source; |
||||
|
columnCollection.ColumnVisibilityChanging += new EventHandler( this.OnColumnVisibilityChanging ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var columnCollection = ( ColumnCollection )source; |
||||
|
columnCollection.ColumnVisibilityChanging -= new EventHandler( this.OnColumnVisibilityChanging ); |
||||
|
} |
||||
|
|
||||
|
private static VisibilityChangingEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( VisibilityChangingEventManager ); |
||||
|
var currentManager = ( VisibilityChangingEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new VisibilityChangingEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void OnColumnVisibilityChanging( object sender, EventArgs args ) |
||||
|
{ |
||||
|
this.DeliverEvent( sender, args ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
[Flags] |
||||
|
internal enum AutoScrollCurrentItemSourceTriggers |
||||
|
{ |
||||
|
None = 0x0000, |
||||
|
Navigation = 0x0001, |
||||
|
Editing = 0x0002, |
||||
|
FocusChanged = 0x0004, |
||||
|
SelectionChanged = 0x0008, |
||||
|
SortChanged = 0x0010, |
||||
|
GroupChanged = 0x0020, |
||||
|
CurrentItemChanged = 0x0040, |
||||
|
CurrentColumnChanged = 0x0080, |
||||
|
CollectionViewCurrentItemChanged = 0x0100, |
||||
|
ColumnsCollectionChanged = 0x0200, |
||||
|
ItemsSourceChanged = 0x0400, |
||||
|
ViewChanged = 0x0800, |
||||
|
ThemeChanged = 0x1000, |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
// Defines the events that trigger the bring into view for the current item.
|
||||
|
[Flags] |
||||
|
public enum AutoScrollCurrentItemTriggers |
||||
|
{ |
||||
|
None = 0x00, |
||||
|
|
||||
|
CurrentChanged = 0x01, |
||||
|
ItemsSourceChanged = 0x02, |
||||
|
FocusChanged = 0x04, |
||||
|
SortChanged = 0x08, |
||||
|
GroupChanged = 0x10, |
||||
|
ViewChanged = 0x20, |
||||
|
ThemeChanged = 0x40, |
||||
|
|
||||
|
All = ~0x00 |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal abstract class AutoResetFlag |
||||
|
{ |
||||
|
#region IsSet Property
|
||||
|
|
||||
|
public abstract bool IsSet |
||||
|
{ |
||||
|
get; |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public abstract IDisposable Set(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,156 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Diagnostics; |
||||
|
using System.Threading; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal static class AutoResetFlagFactory |
||||
|
{ |
||||
|
public static AutoResetFlag Create() |
||||
|
{ |
||||
|
return AutoResetFlagFactory.Create( true ); |
||||
|
} |
||||
|
|
||||
|
public static AutoResetFlag Create( bool singleSet ) |
||||
|
{ |
||||
|
if( singleSet ) |
||||
|
return new SingleAutoResetFlag(); |
||||
|
|
||||
|
return new MultiAutoResetFlag(); |
||||
|
} |
||||
|
|
||||
|
#region IAutoResetFlag Private Interface
|
||||
|
|
||||
|
private interface IAutoResetFlag |
||||
|
{ |
||||
|
void Set(); |
||||
|
void Unset(); |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region ResetFlagDisposable Private Class
|
||||
|
|
||||
|
private sealed class ResetFlagDisposable : IDisposable |
||||
|
{ |
||||
|
internal ResetFlagDisposable( IAutoResetFlag target ) |
||||
|
{ |
||||
|
Debug.Assert( target != null ); |
||||
|
|
||||
|
m_target = target; |
||||
|
m_target.Set(); |
||||
|
} |
||||
|
|
||||
|
private void Dispose( bool disposing ) |
||||
|
{ |
||||
|
var target = m_target; |
||||
|
|
||||
|
// The disposed method has already been called at least once.
|
||||
|
if( Interlocked.CompareExchange<IAutoResetFlag>( ref m_target, null, target ) == null ) |
||||
|
return; |
||||
|
|
||||
|
Debug.Assert( m_target == null ); |
||||
|
Debug.Assert( target != null ); |
||||
|
|
||||
|
// We can only get here if this is the first call to Dispose.
|
||||
|
target.Unset(); |
||||
|
} |
||||
|
|
||||
|
void IDisposable.Dispose() |
||||
|
{ |
||||
|
this.Dispose( true ); |
||||
|
GC.SuppressFinalize( this ); |
||||
|
} |
||||
|
|
||||
|
~ResetFlagDisposable() |
||||
|
{ |
||||
|
this.Dispose( false ); |
||||
|
} |
||||
|
|
||||
|
private IAutoResetFlag m_target; |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region SingleAutoResetFlag Private Class
|
||||
|
|
||||
|
private sealed class SingleAutoResetFlag : AutoResetFlag, IAutoResetFlag |
||||
|
{ |
||||
|
public override bool IsSet |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return ( Interlocked.CompareExchange( ref m_isSet, null, null ) == this ); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public override IDisposable Set() |
||||
|
{ |
||||
|
return new ResetFlagDisposable( this ); |
||||
|
} |
||||
|
|
||||
|
void IAutoResetFlag.Set() |
||||
|
{ |
||||
|
if( Interlocked.CompareExchange( ref m_isSet, this, null ) != null ) |
||||
|
throw new InvalidOperationException( "The flag is already set." ); |
||||
|
} |
||||
|
|
||||
|
void IAutoResetFlag.Unset() |
||||
|
{ |
||||
|
Interlocked.CompareExchange( ref m_isSet, null, this ); |
||||
|
} |
||||
|
|
||||
|
private object m_isSet; //null
|
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region MultiAutoResetFlag Private Class
|
||||
|
|
||||
|
private sealed class MultiAutoResetFlag : AutoResetFlag, IAutoResetFlag |
||||
|
{ |
||||
|
public override bool IsSet |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return ( m_count > 0 ); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public override IDisposable Set() |
||||
|
{ |
||||
|
return new ResetFlagDisposable( this ); |
||||
|
} |
||||
|
|
||||
|
void IAutoResetFlag.Set() |
||||
|
{ |
||||
|
Interlocked.Increment( ref m_count ); |
||||
|
} |
||||
|
|
||||
|
void IAutoResetFlag.Unset() |
||||
|
{ |
||||
|
Interlocked.Decrement( ref m_count ); |
||||
|
} |
||||
|
|
||||
|
private int m_count; //0
|
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,105 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Collections.Generic; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal sealed class AutoScrollCurrentItemSourceTriggersRestrictions |
||||
|
{ |
||||
|
#region Restrictions Property
|
||||
|
|
||||
|
internal AutoScrollCurrentItemSourceTriggers Restrictions |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var result = AutoScrollCurrentItemSourceTriggers.None; |
||||
|
|
||||
|
for( int i = m_restrictions.Count - 1; i >= 0; i-- ) |
||||
|
{ |
||||
|
var item = m_restrictions[ i ].Target as SingleRestriction; |
||||
|
|
||||
|
if( item != null ) |
||||
|
{ |
||||
|
result |= item.Value; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
m_restrictions.RemoveAt( i ); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
internal IDisposable SetRestriction( AutoScrollCurrentItemSourceTriggers value ) |
||||
|
{ |
||||
|
var disposable = new SingleRestriction( value ); |
||||
|
|
||||
|
m_restrictions.Add( new WeakReference( disposable ) ); |
||||
|
|
||||
|
return disposable; |
||||
|
} |
||||
|
|
||||
|
#region Private Fields
|
||||
|
|
||||
|
private readonly List<WeakReference> m_restrictions = new List<WeakReference>(); |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region SingleRestriction Private Class
|
||||
|
|
||||
|
private sealed class SingleRestriction : IDisposable |
||||
|
{ |
||||
|
internal SingleRestriction( AutoScrollCurrentItemSourceTriggers value ) |
||||
|
{ |
||||
|
m_value = value; |
||||
|
} |
||||
|
|
||||
|
internal AutoScrollCurrentItemSourceTriggers Value |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return m_value; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
void IDisposable.Dispose() |
||||
|
{ |
||||
|
this.Dispose( true ); |
||||
|
GC.SuppressFinalize( this ); |
||||
|
} |
||||
|
|
||||
|
private void Dispose( bool disposing ) |
||||
|
{ |
||||
|
m_value = AutoScrollCurrentItemSourceTriggers.None; |
||||
|
} |
||||
|
|
||||
|
~SingleRestriction() |
||||
|
{ |
||||
|
this.Dispose( false ); |
||||
|
} |
||||
|
|
||||
|
private AutoScrollCurrentItemSourceTriggers m_value; |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,74 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal class CellContentStringFormatChangedEventManager : WeakEventManager |
||||
|
{ |
||||
|
private CellContentStringFormatChangedEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public static void AddListener( ColumnBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
CellContentStringFormatChangedEventManager.CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
public static void RemoveListener( ColumnBase source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
CellContentStringFormatChangedEventManager.CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var column = ( ColumnBase )source; |
||||
|
|
||||
|
column.CellContentStringFormatChanged += new EventHandler( this.OnCellContentStringFormatChanged ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var column = ( ColumnBase )source; |
||||
|
|
||||
|
column.CellContentStringFormatChanged -= new EventHandler( this.OnCellContentStringFormatChanged ); |
||||
|
} |
||||
|
|
||||
|
private static CellContentStringFormatChangedEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var managerType = typeof( CellContentStringFormatChangedEventManager ); |
||||
|
var currentManager = ( CellContentStringFormatChangedEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new CellContentStringFormatChangedEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void OnCellContentStringFormatChanged( object sender, EventArgs args ) |
||||
|
{ |
||||
|
this.DeliverEvent( sender, args ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,75 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Windows; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal class ChildColumnVisibilityChangedEventManager : WeakEventManager |
||||
|
{ |
||||
|
private ChildColumnVisibilityChangedEventManager() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
internal static void AddListener( ObservableColumnCollection source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
CurrentManager.ProtectedAddListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
internal static void RemoveListener( ObservableColumnCollection source, IWeakEventListener listener ) |
||||
|
{ |
||||
|
CurrentManager.ProtectedRemoveListener( source, listener ); |
||||
|
} |
||||
|
|
||||
|
protected override void StartListening( object source ) |
||||
|
{ |
||||
|
var columnCollection = ( ObservableColumnCollection )source; |
||||
|
columnCollection.ColumnVisibilityChanged += new EventHandler( this.OnColumnVisibilityChanged ); |
||||
|
} |
||||
|
|
||||
|
protected override void StopListening( object source ) |
||||
|
{ |
||||
|
var columnCollection = ( ObservableColumnCollection )source; |
||||
|
columnCollection.ColumnVisibilityChanged -= new EventHandler( this.OnColumnVisibilityChanged ); |
||||
|
} |
||||
|
|
||||
|
private static ChildColumnVisibilityChangedEventManager CurrentManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
Type managerType = typeof( ChildColumnVisibilityChangedEventManager ); |
||||
|
ChildColumnVisibilityChangedEventManager currentManager = ( ChildColumnVisibilityChangedEventManager )WeakEventManager.GetCurrentManager( managerType ); |
||||
|
|
||||
|
if( currentManager == null ) |
||||
|
{ |
||||
|
currentManager = new ChildColumnVisibilityChangedEventManager(); |
||||
|
WeakEventManager.SetCurrentManager( managerType, currentManager ); |
||||
|
} |
||||
|
|
||||
|
return currentManager; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void OnColumnVisibilityChanged( object sender, EventArgs args ) |
||||
|
{ |
||||
|
this.DeliverEvent( sender, args ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,116 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Collections.ObjectModel; |
||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal abstract class ColumnAddGroupCommand : ColumnGroupCommand |
||||
|
{ |
||||
|
#region GroupDescriptions Protected Property
|
||||
|
|
||||
|
protected abstract ObservableCollection<GroupDescription> GroupDescriptions |
||||
|
{ |
||||
|
get; |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public bool CanExecute( ColumnBase column ) |
||||
|
{ |
||||
|
return this.CanExecute( column, -1 ); |
||||
|
} |
||||
|
|
||||
|
public bool CanExecute( ColumnBase column, int index ) |
||||
|
{ |
||||
|
return ( column != null ) |
||||
|
&& ( this.CanExecuteCore( column, index ) ); |
||||
|
} |
||||
|
|
||||
|
public void Execute( ColumnBase column ) |
||||
|
{ |
||||
|
this.Execute( column, -1 ); |
||||
|
} |
||||
|
|
||||
|
public void Execute( ColumnBase column, int index ) |
||||
|
{ |
||||
|
if( !this.CanExecute( column, index ) ) |
||||
|
return; |
||||
|
|
||||
|
this.ExecuteCore( column, index ); |
||||
|
} |
||||
|
|
||||
|
protected virtual string GetColumnName( ColumnBase column ) |
||||
|
{ |
||||
|
return column.FieldName; |
||||
|
} |
||||
|
|
||||
|
protected virtual GroupDescription GetGroupDescription( ColumnBase column ) |
||||
|
{ |
||||
|
return column.GroupDescription; |
||||
|
} |
||||
|
|
||||
|
protected virtual GroupConfiguration GetGroupConfiguration( ColumnBase column ) |
||||
|
{ |
||||
|
return column.GroupConfiguration; |
||||
|
} |
||||
|
|
||||
|
protected virtual bool CanExecuteCore( ColumnBase column, int index ) |
||||
|
{ |
||||
|
return ( this.GroupDescriptions != null ) |
||||
|
&& ( !string.IsNullOrEmpty( this.GetColumnName( column ) ) ); |
||||
|
} |
||||
|
|
||||
|
protected virtual void ExecuteCore( ColumnBase column, int index ) |
||||
|
{ |
||||
|
var groupDescriptions = this.GroupDescriptions; |
||||
|
if( groupDescriptions == null ) |
||||
|
return; |
||||
|
|
||||
|
GroupDescription groupDescription = this.GetGroupDescription( column ); |
||||
|
if( groupDescription == null ) |
||||
|
{ |
||||
|
groupDescription = new DataGridGroupDescription( this.GetColumnName( column ) ); |
||||
|
} |
||||
|
|
||||
|
var dataGridGroupDescription = groupDescription as DataGridGroupDescription; |
||||
|
if( ( dataGridGroupDescription != null ) && ( dataGridGroupDescription.GroupConfiguration == null ) ) |
||||
|
{ |
||||
|
dataGridGroupDescription.GroupConfiguration = this.GetGroupConfiguration( column ); |
||||
|
} |
||||
|
|
||||
|
if( index < 0 ) |
||||
|
{ |
||||
|
groupDescriptions.Add( groupDescription ); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
groupDescriptions.Insert( index, groupDescription ); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected sealed override bool CanExecuteImpl( object parameter ) |
||||
|
{ |
||||
|
return this.CanExecute( parameter as ColumnBase ); |
||||
|
} |
||||
|
|
||||
|
protected sealed override void ExecuteImpl( object parameter ) |
||||
|
{ |
||||
|
this.Execute( parameter as ColumnBase ); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,62 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Diagnostics; |
||||
|
using System.Windows.Input; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal abstract class ColumnCommand : ICommand |
||||
|
{ |
||||
|
#region Validation Methods
|
||||
|
|
||||
|
protected static void ThrowIfNull( object value, string paramName ) |
||||
|
{ |
||||
|
if( value == null ) |
||||
|
throw new ArgumentNullException( paramName ); |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
protected abstract bool CanExecuteImpl( object parameter ); |
||||
|
protected abstract void ExecuteImpl( object parameter ); |
||||
|
|
||||
|
#region ICommand Members
|
||||
|
|
||||
|
event EventHandler ICommand.CanExecuteChanged |
||||
|
{ |
||||
|
add |
||||
|
{ |
||||
|
} |
||||
|
remove |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
bool ICommand.CanExecute( object parameter ) |
||||
|
{ |
||||
|
return this.CanExecuteImpl( parameter ); |
||||
|
} |
||||
|
|
||||
|
void ICommand.Execute( object parameter ) |
||||
|
{ |
||||
|
this.ExecuteImpl( parameter ); |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Diagnostics; |
||||
|
using System.Windows.Input; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal abstract class ColumnGroupCommand : ColumnCommand |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,261 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.Collections; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel; |
||||
|
using System.Diagnostics; |
||||
|
using System.Windows.Data; |
||||
|
|
||||
|
namespace Xceed.Wpf.DataGrid |
||||
|
{ |
||||
|
internal abstract class ColumnSortCommand : ColumnCommand |
||||
|
{ |
||||
|
protected SynchronizationContext StartSynchronizing( SortDescriptionsSyncContext context ) |
||||
|
{ |
||||
|
return new SynchronizationContext( context ); |
||||
|
} |
||||
|
|
||||
|
protected bool TryDeferResort( DetailConfiguration detailConfiguration, out IDisposable defer ) |
||||
|
{ |
||||
|
defer = null; |
||||
|
|
||||
|
return ( detailConfiguration != null ) |
||||
|
&& ( this.TryDeferResort( detailConfiguration.SortDescriptions, out defer ) ); |
||||
|
} |
||||
|
|
||||
|
protected bool TryDeferResort( SortDescriptionCollection sortDescriptions, out IDisposable defer ) |
||||
|
{ |
||||
|
var dataGridSortDescriptions = sortDescriptions as DataGridSortDescriptionCollection; |
||||
|
if( dataGridSortDescriptions != null ) |
||||
|
{ |
||||
|
defer = dataGridSortDescriptions.DeferResort(); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
defer = null; |
||||
|
} |
||||
|
|
||||
|
return ( defer != null ); |
||||
|
} |
||||
|
|
||||
|
protected IDisposable DeferResortHelper( |
||||
|
IEnumerable itemsSourceCollection, |
||||
|
CollectionView collectionView ) |
||||
|
{ |
||||
|
var dataGridCollectionView = itemsSourceCollection as DataGridCollectionViewBase; |
||||
|
if( dataGridCollectionView != null ) |
||||
|
return dataGridCollectionView.DataGridSortDescriptions.DeferResort(); |
||||
|
|
||||
|
ColumnSortCommand.ThrowIfNull( collectionView, "collectionView" ); |
||||
|
|
||||
|
return collectionView.DeferRefresh(); |
||||
|
} |
||||
|
|
||||
|
#region SynchronizationContext Protected Class
|
||||
|
|
||||
|
protected sealed class SynchronizationContext : IDisposable |
||||
|
{ |
||||
|
#region Constructor
|
||||
|
|
||||
|
internal SynchronizationContext( SortDescriptionsSyncContext context ) |
||||
|
{ |
||||
|
if( context == null ) |
||||
|
throw new ArgumentNullException( "context" ); |
||||
|
|
||||
|
m_context = context; |
||||
|
m_isOwner = !context.ProcessingSortSynchronization; |
||||
|
|
||||
|
context.ProcessingSortSynchronization = true; |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region Own Property
|
||||
|
|
||||
|
public bool Own |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var context = m_context; |
||||
|
|
||||
|
return ( m_isOwner ) |
||||
|
&& ( context != null ) |
||||
|
&& ( context.ProcessingSortSynchronization ); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region IDisposable Members
|
||||
|
|
||||
|
public void Dispose() |
||||
|
{ |
||||
|
this.Dispose( true ); |
||||
|
GC.SuppressFinalize( this ); |
||||
|
} |
||||
|
|
||||
|
private void Dispose( bool disposing ) |
||||
|
{ |
||||
|
var context = m_context; |
||||
|
if( context == null ) |
||||
|
return; |
||||
|
|
||||
|
m_context = null; |
||||
|
|
||||
|
if( m_isOwner ) |
||||
|
{ |
||||
|
context.ProcessingSortSynchronization = false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
~SynchronizationContext() |
||||
|
{ |
||||
|
this.Dispose( false ); |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region Private Fields
|
||||
|
|
||||
|
private SortDescriptionsSyncContext m_context; |
||||
|
private bool m_isOwner; |
||||
|
|
||||
|
#endregion
|
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region Disposer Protected Class
|
||||
|
|
||||
|
protected sealed class Disposer : IDisposable |
||||
|
{ |
||||
|
#region Constants
|
||||
|
|
||||
|
private static readonly int DisposableTypeCount = Enum.GetValues( typeof( DisposableType ) ).Length; |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
public Disposer() |
||||
|
{ |
||||
|
m_disposable = new Stack<IDisposable>[ Disposer.DisposableTypeCount ]; |
||||
|
} |
||||
|
|
||||
|
public void Add( IDisposable disposable, DisposableType disposableType ) |
||||
|
{ |
||||
|
if( m_disposed ) |
||||
|
throw new ObjectDisposedException( "Disposer" ); |
||||
|
|
||||
|
if( !Enum.IsDefined( typeof( DisposableType ), disposableType ) ) |
||||
|
throw new ArgumentException( "disposableType" ); |
||||
|
|
||||
|
if( disposable == null ) |
||||
|
return; |
||||
|
|
||||
|
int index = Disposer.GetIndex( disposableType ); |
||||
|
var collection = m_disposable[ index ]; |
||||
|
|
||||
|
if( collection == null ) |
||||
|
{ |
||||
|
collection = new Stack<IDisposable>(); |
||||
|
m_disposable[ index ] = collection; |
||||
|
} |
||||
|
|
||||
|
collection.Push( disposable ); |
||||
|
} |
||||
|
|
||||
|
private static int GetIndex( DisposableType value ) |
||||
|
{ |
||||
|
int index = System.Convert.ToInt32( value ); |
||||
|
Debug.Assert( ( index >= 0 ) && ( index < Disposer.DisposableTypeCount ) ); |
||||
|
|
||||
|
return index; |
||||
|
} |
||||
|
|
||||
|
#region IDisposable Members
|
||||
|
|
||||
|
public void Dispose() |
||||
|
{ |
||||
|
this.Dispose( true ); |
||||
|
GC.SuppressFinalize( this ); |
||||
|
} |
||||
|
|
||||
|
private void Dispose( bool disposing ) |
||||
|
{ |
||||
|
if( m_disposed ) |
||||
|
return; |
||||
|
|
||||
|
m_disposed = true; |
||||
|
|
||||
|
Exception exception = null; |
||||
|
|
||||
|
for( int i = m_disposable.Length - 1; i >= 0; i-- ) |
||||
|
{ |
||||
|
var disposable = m_disposable[ i ]; |
||||
|
if( disposable == null ) |
||||
|
continue; |
||||
|
|
||||
|
while( disposable.Count > 0 ) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
disposable.Pop().Dispose(); |
||||
|
} |
||||
|
catch( Exception e ) |
||||
|
{ |
||||
|
if( exception == null ) |
||||
|
{ |
||||
|
exception = e; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
m_disposable[ i ] = null; |
||||
|
} |
||||
|
|
||||
|
if( exception != null ) |
||||
|
throw new DataGridInternalException( exception ); |
||||
|
} |
||||
|
|
||||
|
~Disposer() |
||||
|
{ |
||||
|
this.Dispose( false ); |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region Private Fields
|
||||
|
|
||||
|
private readonly Stack<IDisposable>[] m_disposable; |
||||
|
private bool m_disposed; |
||||
|
|
||||
|
#endregion
|
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region DisposableType Protected Nested Type
|
||||
|
|
||||
|
protected enum DisposableType |
||||
|
{ |
||||
|
DeferRestoreState = 0, |
||||
|
DeferResort = 1, |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -1,59 +0,0 @@ |
|||||
/************************************************************************************* |
|
||||
|
|
||||
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; |
|
||||
|
|
||||
using Xceed.Wpf.DataGrid.FilterCriteria; |
|
||||
|
|
||||
namespace Xceed.Wpf.DataGrid.Converters |
|
||||
{ |
|
||||
[ValueConversion( typeof( FilterCriterion ), typeof( Nullable<bool> ) )] |
|
||||
internal class FilterCriterionToNullableBoolConverter : IValueConverter |
|
||||
{ |
|
||||
#region IValueConverter Members
|
|
||||
|
|
||||
public object Convert( object value, Type targetType, object parameter, CultureInfo culture ) |
|
||||
{ |
|
||||
Nullable<bool> boolValue = null; |
|
||||
EqualToFilterCriterion filterCriterion = value as EqualToFilterCriterion; |
|
||||
|
|
||||
if( ( filterCriterion != null ) && ( filterCriterion.Value is bool ) ) |
|
||||
{ |
|
||||
boolValue = ( bool )filterCriterion.Value; |
|
||||
} |
|
||||
|
|
||||
return boolValue; |
|
||||
} |
|
||||
|
|
||||
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture ) |
|
||||
{ |
|
||||
Nullable<bool> boolValue = value as Nullable<bool>; |
|
||||
|
|
||||
if( boolValue.HasValue ) |
|
||||
{ |
|
||||
return new EqualToFilterCriterion( value ); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
return null; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
#endregion
|
|
||||
} |
|
||||
} |
|
||||
@ -1,112 +0,0 @@ |
|||||
/************************************************************************************* |
|
||||
|
|
||||
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.Text; |
|
||||
using System.Windows.Data; |
|
||||
|
|
||||
namespace Xceed.Wpf.DataGrid.Converters |
|
||||
{ |
|
||||
[ValueConversion( typeof( object ), typeof( string ) )] |
|
||||
public class StatResultConverter : StringFormatConverter |
|
||||
{ |
|
||||
#region OverflowMessage Property
|
|
||||
|
|
||||
private string m_overflowMessage = "#OVER#"; |
|
||||
|
|
||||
public string OverflowMessage |
|
||||
{ |
|
||||
get |
|
||||
{ |
|
||||
return m_overflowMessage; |
|
||||
} |
|
||||
set |
|
||||
{ |
|
||||
m_overflowMessage = value; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
#endregion OverflowMessage Property
|
|
||||
|
|
||||
#region DivisionByZeroMessage Property
|
|
||||
|
|
||||
private string m_divisionByZeroMessage = "#DIV/0#"; |
|
||||
|
|
||||
public string DivisionByZeroMessage |
|
||||
{ |
|
||||
get |
|
||||
{ |
|
||||
return m_divisionByZeroMessage; |
|
||||
} |
|
||||
set |
|
||||
{ |
|
||||
m_divisionByZeroMessage = value; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
#endregion DivisionByZeroMessage Property
|
|
||||
|
|
||||
#region InvalidValueMessage Property
|
|
||||
|
|
||||
private string m_invalidValueMessage = "#VALUE#"; |
|
||||
|
|
||||
public string InvalidValueMessage |
|
||||
{ |
|
||||
get |
|
||||
{ |
|
||||
return m_invalidValueMessage; |
|
||||
} |
|
||||
set |
|
||||
{ |
|
||||
m_invalidValueMessage = value; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
#endregion InvalidValueMessage Property
|
|
||||
|
|
||||
#region IValueConverter Members
|
|
||||
|
|
||||
public override object Convert( object value, Type targetType, object parameter, CultureInfo culture ) |
|
||||
{ |
|
||||
if( ( value == null ) || ( value is DBNull ) ) |
|
||||
return null; |
|
||||
|
|
||||
if( value is DivideByZeroException ) |
|
||||
return m_divisionByZeroMessage; |
|
||||
|
|
||||
if( value is OverflowException ) |
|
||||
return m_overflowMessage; |
|
||||
|
|
||||
if( value is Stats.InvalidValueException ) |
|
||||
return m_invalidValueMessage; |
|
||||
|
|
||||
Stats.InvalidSourcePropertyNameException invalidSourcePropertyNameException = value as Stats.InvalidSourcePropertyNameException; |
|
||||
|
|
||||
if( invalidSourcePropertyNameException != null ) |
|
||||
return "#" + invalidSourcePropertyNameException.SourcePropertyName + "#"; |
|
||||
|
|
||||
Exception exception = value as Exception; |
|
||||
|
|
||||
if( exception != null ) |
|
||||
return exception.Message; |
|
||||
|
|
||||
return base.Convert( value, targetType, parameter, culture ); |
|
||||
} |
|
||||
|
|
||||
#endregion
|
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,50 @@ |
|||||
|
/************************************************************************************* |
||||
|
|
||||
|
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.DataGrid.Converters |
||||
|
{ |
||||
|
public class StringFormatMultiConverter : IMultiValueConverter |
||||
|
{ |
||||
|
public object Convert( object[] values, Type targetType, object parameter, CultureInfo culture ) |
||||
|
{ |
||||
|
if( ( values == null ) || ( values.Length <= 0 ) ) |
||||
|
return null; |
||||
|
|
||||
|
var data = values[ 0 ]; |
||||
|
|
||||
|
var format = ( values.Length > 1 ) ? values[ 1 ] as string : null; |
||||
|
if( string.IsNullOrEmpty( format ) ) |
||||
|
return data; |
||||
|
|
||||
|
var currentCulture = ( values.Length > 2 ) ? values[ 2 ] as CultureInfo : null; |
||||
|
if( currentCulture == null ) |
||||
|
{ |
||||
|
currentCulture = culture ?? CultureInfo.CurrentCulture; |
||||
|
} |
||||
|
|
||||
|
return string.Format( currentCulture, format, data ); |
||||
|
} |
||||
|
|
||||
|
public object[] ConvertBack( object value, Type[] targetTypes, object parameter, CultureInfo culture ) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue