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

How to add an icon to header cell to difference between editable and read only columns in the gridview

1 Answer 600 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Yaxuan
Top achievements
Rank 1
Yaxuan asked on 19 Aug 2015, 02:57 PM

Hi,

 I have multiple columns in a table, some are editable and some are read only. I want to add show an icon for the header cell to indicate which column is editable.

 If the column is not editable, the icon is hidden.

 Are there any good way to achieve this?

 I have not found any solution yet. It is possible to add an icon to the header cell template, but how do I get the visibility property set based on data column's property IsReadOnly set to true or false? 

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 24 Aug 2015, 10:47 AM
Hi,

GridViewColumn's Header is an object and you can place any proper control to be displayed as a header. For example you can place a StackPanel with an Image along with TextBlock and apply a converter to its Visibility setting. Since GridViewColumn is not a visual element, its properties cannot be accessed though digging up the visual tree. For the purpose you will need to expose such a property (ReadOnly) in the ViewModel and bind column.IsReadOnlyBinding property to it. Then, bind the Visibility setting to it also.

Please refer to the documenta
tion on Read Only Rows and Cells as well as Column Headers documentation for further information on how to redefine it. 

Regards,
Dimitrina
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
Tags
GridView
Asked by
Yaxuan
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or