This question was asked and answered within another post. I am creating this post to expose it and provide value to other members as I believe the result of implementing this code provides a view that should be the default of the control because there is no need to show sums on a single row element.
This question was answered by Mircho and Elena is going to copy his response to this post.
Many thanks.
Hello Anu,
Instead of set the PivotDataRow's IsVisible to false, you can set its Height to 0 in order to achieve your goal.
Hope this helps you.
Hi Elena,
Tried this sample in a WPF application. It hides the columns and rows. But , now
Expand all the rows and columns are expanded
Now collapse the rows and columns again.
rows and columns gets disappeared.
Would you please provide the solution asap. It's quite urgent.
I am attaching the sample application for your reference.
Regards
Anu
The following is Mircho's answer:
"Hi JaimeZ,
Members count shows you how many hierarchies you have in the row tuple. So this check, r.Tuple.Members.Count == 1, shows that there is only one hierarchy in the row. What i understood is that you want to hide all totals that are aggregating only one item. What i can offer is this one:
foreach (PivotDataRow r in pivotGrid.DataRows){foreach (var member in r.Tuple.Members){if (r.IsTotal & member.ChildCount == 1){r.IsVisible = false;}}}
Hope this will resolve the issue.
Regards,
M. Yovchev"
If you have any additional questions on this matter, please do not hesitate to ask.
Hello All,
Here is the exact quesiton that Jaime asked in the mentioned tread http://community.infragistics.com/forums/p/62354/317534.aspx#317534 :
Hello again,
I was not able to achieve the hiding of row totals only when the members being totalled are greater than a count of 1. This would be a great feature for your pivot grid. Having row totals only where there is more than one data element to total would mean more data to review on screen and less noise. I tried the following code but it hides all row totals in the heirarchy being expanded, not just ones where there is only one member to total:
private void pivotGrid_LayoutLoaded(object sender, EventArgs e) { foreach (PivotDataRow r in pivotGrid.DataRows) { if (r.IsTotal & r.Tuple.Members.Count == 1) { r.IsVisible = false; } } }
It seems that Tuple.Members.Count is always one, which I assume is the root element of each hierarchy being expanded? I was hoping for a way to get a count of what is being totaled, which yet may be possible?