This is a migrated thread and some comments may be shown as answers.

Change Field Caption

6 Answers 102 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Stephan
Top achievements
Rank 1
Stephan asked on 03 Aug 2016, 06:22 AM

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

6 Answers, 1 is accepted

Sort by
0
Polya
Telerik team
answered on 05 Aug 2016, 01:50 PM
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.
0
Stephan
Top achievements
Rank 1
answered on 08 Aug 2016, 05:59 AM

Hi,

yes it works. thanks for help.

Regards.

Stephan

0
Stefania
Top achievements
Rank 2
answered on 29 Nov 2016, 03:48 PM

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

0
Polya
Telerik team
answered on 01 Dec 2016, 01:06 PM
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.
0
Konstantin
Top achievements
Rank 1
Iron
answered on 15 Feb 2024, 01:58 PM

I tried adding a Caption for the DataColumn but nothing worked

0
Vladimir Stoyanov
Telerik team
answered on 16 Feb 2024, 10:30 AM

Hello Konstantin,

I tested this in a sample project on my end and the Caption set to a DataTable column is used in the RadPivotFieldList as intended. That is why I am attaching the sample project that I used for testing purposes. 

Can you check it out and see how it differs from the setup on your end? If you need any further assistance, may I ask you to modify the sample project in order to demonstrate the observed on your end scenario and send it back. This will hopefully allow me to investigate further and better assist you. 

Regards,
Vladimir Stoyanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PivotGrid
Asked by
Stephan
Top achievements
Rank 1
Answers by
Polya
Telerik team
Stephan
Top achievements
Rank 1
Stefania
Top achievements
Rank 2
Konstantin
Top achievements
Rank 1
Iron
Vladimir Stoyanov
Telerik team
Share this question
or