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

ShowColumnSortIndexes default value

2 Answers 144 Views
GridView
This is a migrated thread and some comments may be shown as answers.
KJ
Top achievements
Rank 1
KJ asked on 28 Aug 2014, 10:56 AM
Hi,

I'm trying to set a default value for RadGridView's property ShowColumnSortIndexes. I've tried to do so by adding a style to App.xaml:

<Style TargetType="telerik:RadGridView"><Setter Property="ShowColumnSortIndexes" Value="True" /></Style>

The project builds, but when the first gridview is displayed I get the following error in visual studio (2012):
The property "ShowColumnSortIndexes" is not a DependencyProperty. To be used in markup, non-attached properties must be exposed on the target type with an accessible instance property "ShowColumnSortIndexes". For attached properties, the declaring type must provide static "GetShowColumnSortIndexes"  and "SetShowColumnSortIndexes" methods. 

When settings the property directly on an individual RadGridView, it works as expected.

Can you please show me how to set an application wide default value for this property? I'm using 2014.2

Thanks,

KJ

2 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 28 Aug 2014, 04:03 PM
Hi KJ,


Thank you for contacting us. 

ShowColumnSortIndexes is not a dependency property, indeed.
By that reason you could not define simple style targeted at RadGridView and set its value to True.  

If we introduce such property, it would definitely lead to a breaking change, that we want to avoid.  

As it turns out, with the current version of RadGridView I could not recommend you any appropriate workaround. 

For the time being you may set this property to True only to specific instance of RadGridView

Regards,
Vanya Pavlova
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 12 May 2015, 06:14 AM

Hi KJ,

a solution to the problem would to define your own grid view class that descends from RadGridView and sets this property in the constructor. Then use this class instead of the Telerik one.

Don't forget to define the default style for your control at the application level; otherwise, the grid view will not be displayed.

Tags
GridView
Asked by
KJ
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or