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

Select cells by clicking the column header in RadGridView

2 Answers 364 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tomas
Top achievements
Rank 1
Tomas asked on 28 Oct 2015, 08:14 AM

Hi,

My users need to be able to select cells in a RadGridView by clicking the column header. What is the recommended way of accomplishing this, in a RadGridView (WPF). Thanks in advance for any help.

 

// Tomas

2 Answers, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 29 Oct 2015, 04:22 PM
Hi Tomas,

We have a great demo on setting up the "Column Selection" which you can find in our SDK Sample Browser. You can download it from http://demos.telerik.com/xaml-sdkbrowser/. Once you have it installed you need to navigate to the GridView control and check the "Column Selection" example.  

I have attached a sample project as well that implements the needed behavior. Please, review it and update me if it was useful.

Regards,
Stefan Nenchev
Telerik
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 Feedback Portal and vote to affect the priority of the items
Monica
Top achievements
Rank 1
commented on 04 Nov 2022, 07:39 AM | edited

Hello Stefan Nenchev,

For my project I have used the above code RadGridView-WPF-NoXAML-20.zip 

About this code the handler is applied for all the cells in the grid.

But for me I need to handle this only when clicking the header cell of grid, because we are using converter, selection changed

event for rows of grid which is not working because of this common handler event

Thanks in advance

Stenly
Telerik team
commented on 08 Nov 2022, 05:28 PM

In the "Column Selection" SDK example, the logic in the event handler for the MouseLeftButtonDown event will select the cells only if the clicked element is of the type GridViewHeaderCell. May I ask if you could share a bit more information on the scenario present on your end?
Monica
Top achievements
Rank 1
commented on 14 Nov 2022, 07:01 AM

@Stenly,

In the "Column Selection" SDK example, the logic in the event handler for the MouseLeftButtonDown event will select the cells only if the clicked element is of the type GridViewHeaderCell. May I ask if you could share a bit more information on the scenario present on your end?

> Yes you are correct.  In SDK example during click action in the grid OnMouseLeftButtonDown method is called and this method is differentiating the header cell or row cell.

But I want the event handler to apply only for GridViewHeaderCell, If I click header cell OnMouseLeftButtonDown  should be called and not for other cells.

Because In my project I am having both selection change event handler for Enum Combobox and function to edit the row cells when click action is done. So when I used the SDK example the above selection change event handler and cell edit is not working for me.

Dilyan Traykov
Telerik team
commented on 16 Nov 2022, 12:40 PM

Hello Monica,

To avoid any misunderstandings, would you find it possible to demonstrate your setup and requirement in the sample project that my colleague Stefan provided?

This will help me in finding a viable solution for your particular scenario. Thank you in advance for your cooperation on the matter.

Monica
Top achievements
Rank 1
commented on 18 Nov 2022, 07:20 AM

Hello Dilyan, 

This issue was because of our code and we fixed it, thank you for your support 

0
Tomas
Top achievements
Rank 1
answered on 05 Nov 2015, 01:12 PM
Thank you Stefan, the supplied example helped me in solving my issues with selecting columns!
Tags
GridView
Asked by
Tomas
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Tomas
Top achievements
Rank 1
Share this question
or