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
630
Hierarchies and dynamic objects
posted

Hello,

Please excuse if I'm missing some basic concepts here. I'm attempting to something along the lines of this code snippet, which I found on another forum post:

HierarchyDescriptor<ProductData> dateTimeTodayDescriptor = new HierarchyDescriptor<ProductData>(pd => pd.Today);

dateTimeTodayDescriptor.AddLevel(pd => "Today", "All Dates");

dateTimeTodayDescriptor.AddLevel(pd => pd.Today.SemesterWithYear(), "Semesters");

dateTimeTodayDescriptor.AddLevel(pd => pd.Today.MonthShort(), "Months");

 

However, instead of a known class (in the example, "ProductData"), the ItemSource for my XamPivotGrid consists of a list of dynamic objects created using Infragistics.Olap.DynamicTypeBuilder. I have the property names of the object available in string variables. Any suggestions on how I might modify this example to handle my situation?

I've also tried a completely different approach such as:

// Create a HierarchyDescriptor for a property whose name is stored in col.ColumnName (I'd like it displayed using the string in col.Caption)...

var hier = new HierarchyDescriptor
{
    SourcePropertyName = col.ColumnName,
    HierarchyName = col.Caption,
    HierarchyDisplayName = col.Caption,
};

// Then add a hierarchy level for the property...

HierarchyLevelDescriptor yLevel = new HierarchyLevelDescriptor                    

 {                     

    LevelName = "Years",                     

    LevelExpressionPath = col.ColumnName                     

};                    

System.Linq.Expressions.Expression<Func<DateTime, int>> eY = date => date.Year;                     

yLevel.LevelExpression = eY;                    

hier.LevelDescriptors.Add(yLevel);


But this doesn't work at all (note that the "System.Linq.Expressions....." line is a total guess, since the LevelExpression property has no useful documentation whatsoever -- please take note that "gets or sets the LevelExpressions property"  as the entire explanation doesn't tell us much).

Hopefully I've communicated what I'm trying to do here. Any suggestions of a way to get it done would be greatly appreciated!


And as a side note, what does the HierarchyDisplayName property actually do? It seems to have no effect -- the top of each Hierarchy shows in the XamPivotDataSelector as the ugly raw property name, not the nicer looking "caption" I'm trying to set it to. Can't find a way around that one either...


Thanks,

Bob

Parents Reply
  • 17475
    Offline posted in reply to Bob Fera

    Hello Bob, 

    I understand your concerns. Since currently method calls are not supported, the best approach I could suggest you is getting the returned value of the method using a property. You could also go to this site http://ideas.infragistics.com where new Product Ideas are suggested and create one for this.

    Steps to create your idea:               

    1. Log into the Infragistics Product Ideas site at http://ideas.infragistics.com (creating a new login if needed).
    2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)
    3. Add your product idea and be sure to be specific and provide as much detail as possible. Explain the context in which a feature would be used, why it is needed, why it can’t be accomplished today, and who would benefit from it. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. Be convincing!

     

    The benefits of submitting the product idea yourself include:

    -          Direct communication with our product management team regarding your product idea.

    -          Notifications whenever new information regarding your idea becomes available.

     

    Additional benefits of the Product Idea system include: 

    -          Ability to vote on your favorite product ideas to let us know which ones are the most important to you.  You will have ten votes for this and can change which ideas you are voting for at any time.

    -          Allow you to shape the future of our products by requesting new controls and products altogether.

    -          You and other developers can discuss existing product ideas with members of our Product Management team.

     

    The product ideas site allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.

Children