I have a WinForm PivotGrid bound to a FlatDataSource. I am trying to figure out how to add custom hierarchy that has levels which expand (like the DateTime will do automatically). Each class object contributing to the FlatDataSource may have different number of levels. Some have just one while others may have 5 levels.
I have found some samples using FlatData.HierarchyDescriptor but cannot figure it out.
Can somebody send me in the right direction on now to get this going?
Thanks,
Trausti
I was able to get the levels going by handling InitializeHierarchyDescriptor and adding levels there. This works as expected.
I do still have one problem though. Each class instance in the cube has different number of levels. I need to find a way to have the levels stop dynamically. Does anybody know how to do that?
Here is an example:
The level with the arrow should be the last. There should be no expansion and nothing below.
Sometimes it will only go to one level and sometimes it will go to five levels. I think I have to add as many levels as is my max and then somehow suppress this later as is required.
Please let me know if you know how to solve this.
Hello Trausti,
You are correct in that you need to handle the InitializeHierarchyDescriptor property in order to add hierarchical levels there. As a demonstration for this, I am attaching a sample project that takes a property “Letter” for each letter of the alphabet and groups them using a LevelDescriptor.
Regarding the dynamic generation of this, I believe your best bet to do that would be to return null for the function that serves as the MemberProvider for the LevelDescriptor. For example, if you do this for one of the letter groups in the simple sample project I am attaching, you will notice that no group will be shown for it, but the group below that will no longer be shown either. I believe there will need to be something on your underlying class that you will need to use to designate what levels should be null and which should not, but this is how you would do a dynamic number of groupings.
I hope this helps. Please let me know if you have any other questions or concerns on this matter.
UltraPivotGridHierarchiesDemo.zip