RadListView Index Column

1 Answer 27 Views
ListView
Mahmoud
Top achievements
Rank 1
Mahmoud asked on 27 May 2024, 01:43 PM
Hi team !!!! I want an approach allows me to determine which column was clicked in the RadListView control.

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 30 May 2024, 10:08 AM

Hello, Mahmoud,

You can use the MouseDown event to get the element under the mouse. The DetailListViewDataCellElement gives you direct access to the ListViewDetailColumn by its Data property. The following code snippet demonstrates how to get the column index in RadListView:

 private void RadListView1_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         DetailListViewDataCellElement cell = this.radListView1.ElementTree.GetElementAtPoint(e.Location) as DetailListViewDataCellElement;
         if (cell != null)
         {
             int columnIndex = this.radListView1.Columns.IndexOf(cell.Data);
         }
     }
 }

Feel free to modify the provided example in a way that is most suitable for you.

I hope this helps. If you have any other questions do not hesitate to ask.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

A brand new ThemeBuilder course was just added to the Virtual Classroom. The training course was designed to help you get started with ThemeBuilder for styling Telerik and Kendo UI components for your applications. You can check it out at https://learn.telerik.com
Tags
ListView
Asked by
Mahmoud
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or