Home Forums WPF controls Xceed DataGrid for WPF Performance issue with Filter feature & ObservableCollection

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #25757 |

    Has anyone faced a performance issue with the Filter Feature on a grid that is binded to a ObservableCollection?

    I have noticed that when I have the grid data binded to a ObservableCollection of objects, and each column binded to individual properties of the object, each time a new object is added to the collection, the following calls to the datagrid are made. (Note that i have the filter feature on for every column)

    Xceed.Wpf.DataGrid.dll!Xceed.Wpf.DataGrid.DataGridItemProperty.GetValue(object component = {RIB.Visual.Modules.MasterDataManagement.ServiceDomain.ZipCodeData}) + 0x8b bytes
    Xceed.Wpf.DataGrid.dll!Xceed.Wpf.DataGrid.DataGridCollectionView.ForceRefreshDistinctValues(bool filteredItemsChanged = true) + 0x1e7 bytes
    Xceed.Wpf.DataGrid.dll!Xceed.Wpf.DataGrid.DataGridCollectionView.RefreshDistinctValues(bool filteredItemsChanged = true) + 0xaf bytes
    Xceed.Wpf.DataGrid.dll!Xceed.Wpf.DataGrid.DataGridCollectionView.AddSourceItem(int startIndex = 1305, System.Collections.IList items = {Dimensions:[1]}, int newSourceItemCount = -1) + 0x2bb bytes
    Xceed.Wpf.DataGrid.dll!Xceed.Wpf.DataGrid.DataGridCollectionView.NotifyCollectionChanged_CollectionChanged(object sender = Count = 1306, System.Collections.Specialized.NotifyCollectionChangedEventArgs e = {System.Collections.Specialized.NotifyCollectionChangedEventArgs}) + 0x1dd bytes
    Xceed.Wpf.DataGrid.dll!Xceed.Wpf.DataGrid.DataGridCollectionView.System.Windows.IWeakEventListener.ReceiveWeakEvent(System.Type managerType = {Name = “CollectionChangedEventManager” FullName = “System.Collections.Specialized.CollectionChangedEventManager”}, object sender = Count = 1306, System.EventArgs e = {System.Collections.Specialized.NotifyCollectionChangedEventArgs}) + 0x5e bytes

    A call is also made to each property of the object, i believe, to cater for filtering.

    This results in a HUGE performance issue for us. Is there a work around to this? Or is this how the filter feature is designed to work?

    Serene

    Imported from legacy forums. Posted by Serene (had 3283 views)

    Xceed Support
    Member
    Post count: 5658

    I entered a bug report for this issue, will keep you informed.

    Imported from legacy forums. Posted by Chris [Xceed] (had 964 views)

    User (Old forums)
    Member
    Post count: 23064

    I however got this exception instead:

    System.Windows.Data Error: 12 : Cannot get ‘DistinctValues’ value (type ‘ICollection’) from ‘ParentColumn’ (type ‘Column’). BindingExpression:Path=ParentColumn.DistinctValues.Count; DataItem=’ColumnManagerCell’ (Name=”); target element is ‘ColumnManagerCell’ (Name=”); target property is ‘NoTarget’ (type ‘Object’) TargetInvocationException:’System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.ArgumentNullException: Value cannot be null.
    Parameter name: dataGridItemProperty
    at Xceed.Wpf.DataGrid.DataGridCollectionView.SafeGetDistinctValues(DataGridItemProperty dataGridItemProperty)
    at Xceed.Wpf.DataGrid.DataGridCollectionView.GetDistinctValues(String fieldName)
    at Xceed.Wpf.DataGrid.Column.get_DistinctValues()
    — End of inner exception stack trace —
    at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
    at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
    at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
    at MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level)
    at MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)’

    Imported from legacy forums. Posted by nat (had 521 views)

    Xceed Support
    Member
    Post count: 5658

    Do you need AutoFiltering for every properties? By activating filtering for every properties,
    the DataGridCollectionView calculates distinct values for each DataGridItemProperty defined. This takes time since the hole collection needs to be reparsed and the list of distinct values for each property must also be updated. This parsing is done on each modification of the collection.

    To optimize, you should deactivate AutoFiltering feature on non required properties by setting the CalculateDistinctValues to false. If you use the DataGridCollectionViewSource, you can set the DefaultCalculateDistinctValues to false, and only activate AutoFiltering on required DataGridItemProperties.

    Imported from legacy forums. Posted by Chris [Xceed] (had 4362 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.