I know this is another post but the solution shown has been using the code behind and the links give don't help.
http://help.infragistics.com/Help/NetAdvantage/WPF/2013.1/CLR4.0/html/xamPivotGrid_US_Defining_Hierarchies_And_Providing_Metadata_With_FlatData.html
I've already gone through that page before. I was more interested in doing the XAML version of what you just did in this thread for date hierarchy. Specifically renaming levels and removing the semester or the H.
http://ko.infragistics.com/community/forums/t/54072.aspx
Can you shed some light on it? I've tried experimenting on this and the following just makes the grid hang:
<olap:HierarchyDescriptor SourcePropertyName="DATE_COLLECTED" HierarchyDisplayName="Collection Date" >
<olap:HierarchyDescriptor.LevelDescriptors><olap:HierarchyLevelDescriptor LevelName="All Periods"/><olap:HierarchyLevelDescriptor LevelName="Year" LevelExpressionPath="Year"/><olap:HierarchyLevelDescriptor LevelName="Short Quarter" LevelExpressionPath="QuarterShort()"/><olap:HierarchyLevelDescriptor LevelName="Short Month" LevelExpressionPath="MonthShort()"/><olap:HierarchyLevelDescriptor LevelName="Day" LevelExpressionPath="DATE_COLLECTED"/></olap:HierarchyDescriptor.LevelDescriptors></olap:HierarchyDescriptor>
Hello,
Thank you for your post. I have been looking into it and the links you have provided and it seems like that the best way to achieve your goal is to use the approach Todor suggested in the other forum thread and use code behind to define HierarchyLevelDescriptors.
Hope this helps you.
Thanks for the response Stefan.
Does that mean I have to move all my xaml hierarchy descriptor code to the code behind? Or is it possible to have a hybrid solution?
Also, what event handler should I put the code behind in? I've been experimenting and couldn't seem to get it in the correct sequence of events.
You can define the HierarchyDescriptors in XAML and set the levels in code. You can get the Hierarchies like this:
flatDataSource.HierarchyDescriptors.Where(hd => hd.HierarchyDisplayName == "Collection Date").First().AddLevel<DateTime> (dt => dt.SemesterShort(), "Semesters");
but note that the levels should be added before you set the FlatDataSource as DataSource to the XamPivotGrid.
We already have all the HierarchyDescriptors and levels set on XAML except for the Date hierarchies.
As you've mentioned, "but note that the levels should be added before you set the FlatDataSource as DataSource to the XamPivotGrid." is there an event handler we need to implement in the FlatDataSource, e.g. "LoadDimensionsCompleted" or "LoadCubesCompleted" where we can put your specified code?
We're setting the DataSource for the XamPivotGrid in XAML, so we don't know the correlating succession of events that are happening if we try to interrupt that in the code behind to insert those levels.
Keep in mind, we have that Hybrid solution.
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
You can execute the code I suggested you after the InitializeComponent method in the MainWindow's constructor.