Change Field Caption

5 posts, 0 answers
  1. Stephan
    Stephan avatar
    12 posts
    Member since:
    Jun 2011

    Posted 03 Aug Link to this post

    Hi,

    i would like to change the Field Displayname of Properties used in the Pivot-Fieldlist.

    I tryed to use the AddingContainerNode Event from LocalDataSourceFieldDescriptionsProvider, but it's only possible to change the

    display name like

        (e.ContainerInfo as PropertyInfoFieldInfo).DisplayName = "Test"

    This works for the aggregate list, but in List of fields there is always the name of property visible.

    I tryed to change also the caption of ContainerNode but there is no Setter implemented.

        e.ContainerNode.Caption ="Test";  //it's not possible, but ist seems to be there right way 

    Is there another way to Change the Caption.

    Thanks for help.

    Best regards

    Stephan

  2. Polya
    Admin
    Polya avatar
    199 posts

    Posted 05 Aug Link to this post

    Hello Stephan,

    If you are using LocalDataSourceProvider, in order to change the name used in the RadPivotFieldList for a specific field you can use the Display attribute for this field as explained in this help article: http://docs.telerik.com/devtools/wpf/controls/radpivotgrid/features/localdatasourceprovider/data-annotations

    Please give it a try and let us know if it works for you.

    Regards,
    Polya
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Stephan
    Stephan avatar
    12 posts
    Member since:
    Jun 2011

    Posted 08 Aug in reply to Polya Link to this post

    Hi,

    yes it works. thanks for help.

    Regards.

    Stephan

  5. Stefania
    Stefania avatar
    107 posts
    Member since:
    May 2013

    Posted 4 days and 6 hours ago Link to this post

    Hi, is it possible to do the same with a DataTable or an expando object (dynamic) as ItemSource?

    My problem is that I have to create my object runtime.

     

    Thank you

  6. Polya
    Admin
    Polya avatar
    199 posts

    Posted 2 days and 9 hours ago Link to this post

    Hi Stefania,

    It is not possible to use ExpandoObject as a source for RadPivotGrid. The reason is that reflection doesn't work as expected on dynamic types. LocalDataSourceProvider uses reflection to examine its object's properties, and ExpandoObject doesn't have any (static) properties. 
    You can convert your ExpandoObject to DataTable at runtime as shown in this thread.

    Then you can use the Caption property of each DataColumn added to the DataTable to change the field caption associated with this DataColumn.

    Regards,
    Polya
    Telerik by Progress
    Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Back to Top
UI for WPF is Visual Studio 2017 Ready