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

Change Field Caption

4 Answers 68 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

4 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.
Tags
PivotGrid
Asked by
Stephan
Top achievements
Rank 1
Answers by
Polya
Telerik team
Stephan
Top achievements
Rank 1
Stefania
Top achievements
Rank 2
Share this question
or