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

Column header click plus ModifierKeys

3 Answers 24 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rick Glos
Top achievements
Rank 1
Rick Glos asked on 09 Apr 2010, 12:25 AM
I'd like to support different actions on columns when the user uses Control or Alt keys and clicking on a Header column.

I saw this post, but when I use that method (a RoutedEvent), it seemed a little intermittent.  I'd click, get the ShowWindow, click OK, and then the grid wouldn't sort.  Then sometimes it would.

When they do a normal click, I'd still like to sort.  If they Shift+click I'd still like to multi-sort.  And I'd still like them to be able to filter when clicking that icon.

I only want to intercept specific ModifierKeys (Alt, Control) and a click.  Any ideas?

3 Answers, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 14 Apr 2010, 09:06 AM
Hi Rick Glos,

When the header is clicked RadGridView will automatically sort by that column. It also has the shift + click for multiple column sorting built-in. You can use RadGridView's Sorting event and check the modifier keys there. If the alt key is pressed you can cancel the sorting and do you own logic.

Also you can use the Header property of the column to define any UI elements that should be displayed in the header. For example a custom button that implements your custom logic on click.

Will these cases cover your requirements?

Kind regards,
Stefan Dobrev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Rick Glos
Top achievements
Rank 1
answered on 16 Apr 2010, 05:49 PM
The idea of handling the sorting event sounds promising.

If I cancel the sorting in the sorting event handler, the sort arrow still appears above the column I clicked on.

        private void RadGridViewMainGridSortingEventHandler(object sender, GridViewSortingEventArgs e) 
        { 
            // TODO: This cancels the sort, but the sort arrow still appears over the column clicked. 
            e.Cancel = true
        } 

That doesn't seem correct.
0
Stefan Dobrev
Telerik team
answered on 19 Apr 2010, 01:16 PM
Hello Rick,

You should set the NewSortingState property of the event args to your desired value - None in your case. You need to set this property because we does not have an idea what will be your next logical sorting state when custom sorting is implemented. You can find more information about this in our online help - here.

Best wishes,
Stefan Dobrev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Rick Glos
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Rick Glos
Top achievements
Rank 1
Share this question
or