Home Forums WPF controls Xceed DataGrid for WPF Bug: Binding with ITypedList

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

    I’m binding to a custom collection similar to this:-

    public class People : BindingList<Person>, ITypedList

    Each time the data source changes, the grid calls ITypedList::GetItemProperties() but it doesn’t clear its previous column collection – it just adds the new columns to the collection.

    I’m actually using ITypedList to return each Person as a column in order to do a crosstab query on other collections which is why the columns change whenever the data source changes.

    Should be an easy thing to fix. Could you confirm if it’s a known bug and whether it will be fixed in the next release?

    Thanks
    Michael

    PS. I’m binding directly to the source rather than to a CollectionViewSource wrapper. GetItemProperties doesn’t seem to get called at all for a CollectionViewSource.

    Imported from legacy forums. Posted by Michael (had 749 views)

    Xceed Support
    Member
    Post count: 5658

    This behavior is by design and will not be fixed in the next release.

    If you need the columns to be cleared when the ItemsSource changes, you can call myDataGridControl.Columns.Clear() before changing the ItemsSource.

    Hope this helped.

    Note: To benefit from the DataGridCollectionView’s enhancements, you should use the DataGridCollectionViewSource instead of the CollectionViewSource.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 274 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Marcus,

    Thanks for the speedy reply. I’m using Columns.Clear() as you suggested but it has a sort of flashing effect as the columns are cleared and before the new ones are created. Is there any way the freeze the updating until the new column set has been loaded?

    Thanks
    Michael

    Imported from legacy forums. Posted by Michael (had 392 views)

    User (Old forums)
    Member
    Post count: 23064

    Michael,

    Have you tried to clear the data, rebind and then call grid.UpdateLayout() in the same method? It should reduce the flickering

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

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