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
558
CellValuePresenter Expandable Row Style
posted

I have a grid that contains a sublist under it.  I would like to display data on that parent record row only if the row is not expanded.  For example, I have a Toy and a Child object as defined below.  I only want to show the ParentName if the row is collapsed.  Is this possible?

public class Toy

    {

        public string ID { get; set; }

        public string Name { get; set; }

    }

 

    public class Child

    {

        public string Name { get; set; }

        public string ParentName { get; set; }

        public List<Toy> Toys { get; set; }

    }

Parents
  • 558
    posted

    I was able to get it partially there.  I created a style on the CellValuePresenter and assigned it to the ParentName.  I added to the Child class a property IsExpanded and made it implement INotifyPropertyChanged.  Furthermore, I change the property when the row is expanded or collapsed and that hides the ParentName column.  However, there's a very annoying bug that I'm having trouble deciphering.  When I hover over the Name column when the row's are expanded, the ParentName is displayed.  I'm not sure why.

     

     

    I've attached the source code.

     

     

    Source.zip
Reply Children