This question is locked. New answers and comments are not allowed.
Is there any way to make a column, or its individual cells (with SelectionMode="Single" and SelectionUnit="Cell"), non-selectable?
The idea is for the user to be able to select a cell in any column other than the first one.
The idea is for the user to be able to select a cell in any column other than the first one.
4 Answers, 1 is accepted
0
Hello Yuri,
Thank you for contacting us.
In this scenario, you can take advantage of the CellTap Command of the RadDataGrid. As you can see in the help article, the CanExecute(and also the Execute) method receives a parameter of type DataGridCellInfo that exposes a Column property. Thus, you can return false when the cell is from the first column. Note, that in the Execute method you need to execute the default command like this:
Ivaylo Gergov
Telerik
Thank you for contacting us.
In this scenario, you can take advantage of the CellTap Command of the RadDataGrid. As you can see in the help article, the CanExecute(and also the Execute) method receives a parameter of type DataGridCellInfo that exposes a Column property. Thus, you can return false when the cell is from the first column. Note, that in the Execute method you need to execute the default command like this:
this.Owner.CommandService.ExecuteDefaultCommand(CommandId.CellTap, parameter);I hope this helps. Let me know if I can assist you in some other way.
Ivaylo Gergov
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Yiqing
Top achievements
Rank 1
answered on 25 Jul 2013, 05:57 PM
Hi Ivaylo,
I see 'Column' in DataGridCellInfo, but it is returned as DataGridColumn type. I wonder how can I get to know which specific column it is?
Thanks,
Yiqing
I see 'Column' in DataGridCellInfo, but it is returned as DataGridColumn type. I wonder how can I get to know which specific column it is?
Thanks,
Yiqing
0
Yiqing
Top achievements
Rank 1
answered on 25 Jul 2013, 05:57 PM
Hi Ivaylo,
I see 'Column' in DataGridCellInfo, but it is returned as DataGridColumn type. I wonder how can I get to know which specific column it is?
Thanks,
Yiqing
I see 'Column' in DataGridCellInfo, but it is returned as DataGridColumn type. I wonder how can I get to know which specific column it is?
Thanks,
Yiqing
0
Hello Yiqing,
In this case you can use several approaches:
I hope this is useful.
Ivaylo Gergov
Telerik
In this case you can use several approaches:
- get the Header of the column:
var header = (parameter as DataGridCellInfo).Column.Header;- get the Name of the column which is unique:
var name = (parameter as DataGridCellInfo).Column.Name;- get the index of the column in the RadDataGrid.Columns collection:
var index = this.Owner.Columns.IndexOf((parameter as DataGridCellInfo).Column);I hope this is useful.
Regards,
Ivaylo Gergov
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.