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
Hi Andrew,
I realized there is still one issue present. Your suggestion works in the sense that the levels do not show up. But the last level has expansion indicator when it should not.
Here is an example:
The arrow point to last level. Clicking on the expansion indicator makes them go away. Do you know how I can get it to come up like this:
Thanks for that, Andrew, that was almost too simple to be true!
Returning null, when the level value is blank, gave the result I was looking for.
Thanks again for your time and help,
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
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?
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.