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
65
expand pivot grid
posted

Hi,

I was trying to change the default behaviour of the pivot grid (Expand the rows and columns) by

 default you have to expand the "+" sign to see al lthe data.

I can't seem to find a way to do this. Is there a way of making all the rows and columns expand?

I noticed on the samples that when using a flat data source the rows and columns are expanded

but i couldn't see how this was done.

Thanks.

 

Parents
No Data
Reply
  • 7922
    Verified Answer
    posted

    Hi

     

    There are two ways to expand hierarchy from code behind.

    The first one is to work with HeaderCells. The second one is to work with filter tree. The filter tree is related with visualizated hierarchy and when you expand/collapse node in tree the grid automaticaly update and header hierarchy.

     

    For first one you can use the follow code

    public EmptyPage()

    {

        InitializeComponent();

        pivotGrid.LayoutLoaded += pivotGrid_LayoutLoaded;

    }

     

    void pivotGrid_LayoutLoaded(object sender, EventArgs e)

    {

        foreach (PivotHeaderCell cell in pivotGrid.GridLayout.ColumnHeaderCells)

        {

            if (cell.IsToggleVisible && cell.IsExpanded == false)

            {

                cell.IsExpanded = true;

                return;

            }

        }

    }

     

    For second approach you can read this article

     

    Regards

    Todor

Children