PivotGrid with complex types.

6 posts, 1 answers
  1. tristan Brenner
    tristan Brenner avatar
    4 posts
    Member since:
    Dec 2009

    Posted 15 Sep 2013 Link to this post

    Hi,
    We are using PivotGrid with localdatasourceProvider connected to an Entity Framework DbContext.
    We are using a navigation property to group the datas.
    Pivotgrid display the name of our object returned by  .toString().
    We would like to display one property of this object for our datatemplate.

    What is the best solution ?

    Thanks for all, Tristan
  2. tristan Brenner
    tristan Brenner avatar
    4 posts
    Member since:
    Dec 2009

    Posted 16 Sep 2013 Link to this post

    Hi,
    I still not achieve to display my related data : I tried to use the row header datatemplateselector.
    But I can't get my object in Parameters Items or Containers.

    Thanks for your ideas
  3. UI for WPF is Visual Studio 2017 Ready
  4. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 18 Sep 2013 Link to this post

    Hi Tristan,

    From your other thread I assume your problem is only with the name shown in RadPivotGrid - the data is fine, am I correct? If this is the case there are several ways to change the name in the UI. First one is to use DataAnnotations and set a name for the property in the generated from Entity Framework code:
    [Display (Name="Test")]
    public virtual ICollection<Customer> Customers { get; set; }

    You can find more information about DataAnnotations in our online help.
    The other option is to set CustomName property of the PropertyGroupDescription:
    <pivot:PropertyGroupDescription PropertyName="Customers" CustomName="Test" />

    Feel free to contact us in case you have any problems or concerns or I have misunderstood your problem.

    Regards,
    Rosen Vladimirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  5. tristan Brenner
    tristan Brenner avatar
    4 posts
    Member since:
    Dec 2009

    Posted 18 Sep 2013 Link to this post

    Thank you Rosen,
    Our model is two tables : Customers and Orders.
    In the class Order we have the property 'CustomerId' and the NavigationProperty 'Customer'.
     In the class Customer we have the properties 'Name' and 'Id'.
    We would like to use the link Order.Customer .

    We do not want to change the name of the table, We would like to acceed to the property 'Name' in the pivotgrid in the groupdescription even if the datas came from the table Orders.

    I hope it is more clear.

    Tristan
  6. Answer
    Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 19 Sep 2013 Link to this post

    Hi Tristan,

    In order to achieve this you will have to flatten your data in the application. That is the only way to use the data from Orders table in RadPivotGrid - you have to create an object for each order of a customer (I assumed the relation between Customers and Orders is 1:M).

    I've prepared a sample project to demonstrate this approach. Could you check it and inform us in case you have any problems or concerns?

    Regards,
    Rosen Vladimirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  7. tristan Brenner
    tristan Brenner avatar
    4 posts
    Member since:
    Dec 2009

    Posted 20 Sep 2013 Link to this post

    Hi Rosen,
    Thank you for this solution. We built a new class with the properties linked to the fields of our differents tables and that's ok !
    Thanks for all
    Bye, Tristan
Back to Top
UI for WPF is Visual Studio 2017 Ready