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

Disable focus on readonly columns

3 Answers 527 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Simon Störmer
Top achievements
Rank 1
Simon Störmer asked on 01 Jun 2015, 02:30 PM

Hi,

regarding to the post "http://www.telerik.com/forums/avoid-focus-on-radgridviewcolumn"

is there a possibility to disable the focus on a read only grid column? The property "Focusable" has no effect.

3 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 02 Jun 2015, 04:39 PM
Hi Simon ,

As there is no built-in functionality to achieve this, a possible approach would be to use the IsEnabled property of GridViewCell. For this purpose, you will need to define a Style and apply it through the CellStyle property of GridViewDataColumn:
<Style x:Key="disabledCellStyle" TargetType="telerik:GridViewCell">
    <Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>
</Style>

<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" IsReadOnly="True"
         CellStyle="{StaticResource disabledCellStyle}"/>

Hope this helps.

Regards,
Stefan X1
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
0
Bharat
Top achievements
Rank 1
answered on 15 Sep 2015, 09:02 AM
How Can we achieve this in c# code, i am not creating the columns from xaml..
0
Stefan
Telerik team
answered on 16 Sep 2015, 04:09 PM
Hi Bharat,

The Style can be defined in XAML and then set programmatically through the CellStyle property of a given column. You can take a look at the code snippet below.
GridViewDataColumn col = new GridViewDataColumn()
{
    CellStyle = this.Resources["disabledCellStyle"] as Style
};

Regards,
Stefan X1
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
Simon Störmer
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Bharat
Top achievements
Rank 1
Share this question
or