Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
565
How to restyle DataRecordPresenter to hide HeaderRecord is it is header for child records
posted

I try to use XamDataGrid with a collection of items of the class Foo as the :

class  Foo
{
    public int Id { get; set; }

    public string Name { get; set; }

   public ObserervableCollection<Foo> Children { get; set; }

}

For top-level items of Foo and children of Foo items, they use the same field layout.

I don't want to maintain two field layouts (one for top-level items and one for children) as there is lots of programmatic customization based on external data.  It's messy enough doing it once, and the required synchronization to keep all the columns in line is burdensome.

It looks like I should be able to restyle the DataRecordPresenter, but I can't figure out how to get it to work as the only properly on HeaderRecord that has any information about its nested level is internal to the class AttachedNestingLevel (if I remember right).

Even so, I mucked about with reflection to use that value and while I can detect the header, I was never able to hide the data record.  My guess is the DataRecordPResenter is just too complex for my old mind to get figured out.

How can I restyle the Data Record Presenter to hide the redundant column header for children items?

 The highlighted row is what I want to hide: in the real app: