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

[Solved] Create header column that does not allow navigation

1 Answer 52 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mark Allen
Top achievements
Rank 1
Mark Allen asked on 10 Mar 2010, 11:17 PM
I need to create a grid that is a similar layout to the Silverlight Toolkit DataForm control. The grid allows indexing of fields in a vertical orientation. The grid requires 2 columns : the first is the label for the index field, the second is the field for editing the value.

The grid binds to an ObservableCollection<IndexFieldViewModel>. The IndexFieldViewModel exposes both FieldName and Value properties, with the label and value grid columns binding to those properties respectively.

I started down the road of leveraging the selection column for the label, but read on the forum that it was not possible to bind values into this column. So I am now implementing 2 data columns, the first (label) which is read-only, and the second (value) which is editable.

My difficulty is that I need the label column to be skipped for the purposes of navigation : 
1) if you tab through the grid, the label cell should be skipped and focus should be placed on the value cell of that row; 
2) if you shift-tab through the grid, the label cell should be skipped and focus should be placed on the value cell of the previous row;
3) if you mouse-click on the row, focus should automatically shift to the value cell in that row.

After inspecting the documentation and forums, it was not clear how this could be done. Can you point me in the right direction?

Thanks,
Mark

1 Answer, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 15 Mar 2010, 01:35 PM
Hi Mark,

If you set IsReadOnly property to true on your label column it will not participate in keyboard navigation.

Regarding the mouse click handling you can use the cell double click event as illustrated in this online example. When a cell is double clicked you can check its column and if it is the label one you can use this code:
((GridViewRow)cell.ParentRow).BeginEdit()
which will put your value cell on this row into an edit mode.

Hope this helps,
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
Mark Allen
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Share this question
or