Home Forums WPF controls Xceed DataGrid for WPF How do I change FixedHeaders dynamicaly

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

    I have a collection of objects of class ClassOne. When I bind it to a grid it creates columns which are correspond to a set of properties in the ClassOne. If I have another collection of objects of class ClassTwo and want the same grid to display it how do I make the header to reflect properties of that new type of objects? If I do nothing the grid just creates additional columns and keeps the old ones.

    Imported from legacy forums. Posted by Alexander (had 2313 views)

    User (Old forums)
    Member
    Post count: 23064

    You could try this:

    Override the OnItemsSourceChanged event and call a clear columns before proceeding

    protected override void OnItemsSourceChanged(System.Collections.IEnumerable oldValue, System.Collections.IEnumerable newValue)
    {
    this.Columns.Clear();

    base.OnItemsSourceChanged(oldValue, newValue);
    }

    I’m not sure if this is the best way to do this. But it worked for me.

    Serene

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

    User (Old forums)
    Member
    Post count: 23064

    Thank you very much. That worked.

    Imported from legacy forums. Posted by Alexander (had 3446 views)

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