ShowColumnSortIndexes default value

3 posts, 0 answers
  1. KJ
    KJ avatar
    2 posts
    Member since:
    Jan 2014

    Posted 28 Aug 2014 Link to this post

    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. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 28 Aug 2014 Link to this post

    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.
     
  3. Patrick
    Patrick avatar
    418 posts
    Member since:
    Aug 2012

    Posted 12 May 2015 in reply to KJ Link to this post

    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.

Back to Top