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
440
XamPivotGrid Hide expansion indicator
posted

Is there any way to programmatically hide the expansion indicator? For example, the data behind my grid has subvalues for some fields but not others, and I would want to hide the expansion indicator for these others rather than have them expand into N/A.

In the below example (fig 1), the hierarchy is Level_2 -> Level_3 -> Level_4, but many of my objects have null values for Level_4, so rather than displaying an expansion indicator that, when clicked, expands to N/A (fig 2), I'd rather hide the expansion indicators when the value in the next level of the hierarchy is null (fig 3). Is there any way I can accomplish this?

Fig 1:

Fig. 2:

 

Fig. 3: (What I want)

  • 17559
    Verified Answer
    posted

    Hello palen,

     

    I have been investigating the issue that you are referring and I believe that the functionality that you require can be achieve by manually iterating through all of the Tuples and Members in your ColumnAxis and RowAxis and where the current member has a child with caption equal to “N/A” you can assign to the corresponding PivotHeaderCellControl style with hidden expansion indicator. You can achieve this by checking every member if it has children and which is their values. For example you can check the first cell from the RowAxis for “N/A” values by:

    foreach (IMember m in pivotGrid.DataSource.Result.RowAxis.Tuples[0].Members[0].Members)

                    if (m.Caption == "N/A")

                    {

                        IMember currentMemeber = pivotGrid.DataSource.Result.RowAxis.Tuples[0].Members[0];

                        (pivotGrid.GridLayout.RowHeaderCells.Where(c => c.Member == currentMemeber).First() as PivotHeaderCell).Style = this.Resources["RowStyle"] as Style;

                    }

    Please notice that implemented like this I will hide the expansion indicator for every header cell which has at least one “N/A” child cell. For further reference, please have a look at the attached sample.

    HiddenExpansionIndicatorXPG.zip