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

Style GridViewCheckBoxColumn

5 Answers 237 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rudis
Top achievements
Rank 1
Rudis asked on 19 Nov 2010, 11:38 AM
Hello!

I would like to style a GridViewCheckBoxColumn triggered if the CheckBox is readonly or not. The differense between true and false is to small.

<telerik:GridViewCheckBoxColumn Header="Klart"
                   DataMemberBinding="{Binding ChKlar, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                   IsReadOnlyBinding="{Binding Uppdaterbar, Mode=OneWay}"
                   EditTriggers="CellClick"
                   AutoSelectOnEdit="True" />

Any Ideas?

Best regards / Anna

5 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 23 Nov 2010, 10:23 AM
Hello Anna,


Actually IsReadonlyBinding does not affect directly the GridViewCheckBox's appearance, this property does not allow you to go into edit mode. I strongly recommend you to review this topic, the approach is the same in WPF, Configure CheckBox as GridViewCheckBox. You can change this behavior in IsReadOnly through edit the template of GridViewCheckBox and adding some custom behavior in your own trigger to handle this case. 


Please let me know if you need any further assistance.
 

Greetings,
Vanya Pavlova
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Rudis
Top achievements
Rank 1
answered on 23 Nov 2010, 12:43 PM
But I can´t see that GridViewCheckBox has a IsReadOnly property to trigger on? Could you please send me an example.

Best regards,
Anna
0
Vanya Pavlova
Telerik team
answered on 23 Nov 2010, 04:18 PM
Hi Anna,



With my colleague Yavor we have created a project that illustrates this approach. The IsReadOnlyBinding property of GridViewCheckBoxColumn is bound to the boolean IsActive property of the underlying object. Within the RadGridView's CellLoaded event we perform a checking for that value and the corresponding style for GridViewCheckBox is returned. If you want to change the value in all editable GridViewCheckBox to True just refresh the items.


Please see the attached project and if you need any further assistance let me know.


Greetings,
Vanya Pavlova
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Rudis
Top achievements
Rank 1
answered on 23 Nov 2010, 07:06 PM
Ok, so the only way is to use the CellLoaded event? Personally I really don't like this solution. But if its the only way to make them look different...

I´m curious, why have you made the states look the same? Why is the CheckBox not "disabled-looking" when it is readonly?

Best regards,
Anna
0
Vanya Pavlova
Telerik team
answered on 25 Nov 2010, 01:34 PM
Hello Anna,

The GridViewCheckBox is gray colored by design, actually internally cannot trigger IsReadOnly property, because it is very basic and lightweight alternative of the standard CheckBox. Retemplating procedure of a CheckBox is not a trivial task and some issues that you might have can be reduced using GridViewCheckBox in different scenarios in our RadGridView.
 

Sincerely yours,
Vanya Pavlova
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
Tags
GridView
Asked by
Rudis
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Rudis
Top achievements
Rank 1
Share this question
or