Good day,
I am using RadGridView control using 2009 Q2 version of Telerik. And i have the following problem.
I am using bindings for having some control on some behavior into the Grid. My idea is, binding the column to a property, set unable and disable the checkbox we have in the column. For that i use RelativeSource FindAncestor
<
telerik:GridViewDataColumn
UniqueName
=
"List"
IsFilterable
=
"False"
Width
=
"100"
>
<
telerik:GridViewColumn.HeaderCellStyle
>
<
Style
TargetType
=
"telerik:GridViewHeaderCell"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:GridViewHeaderCell"
>
<
StackPanel
Orientation
=
"Vertical"
>
<
TextBlock
Text
=
"Edit"
HorizontalAlignment
=
"Center"
></
TextBlock
>
<
CheckBox
x:Name
=
"AllEdited"
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
Click
=
"AllEdited_Click"
Validation.ErrorTemplate
=
"{x:Null}"
IsEnabled
=
"{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=DataContext.EditMode}"
></
CheckBox
>
</
StackPanel
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
telerik:GridViewColumn.HeaderCellStyle
>
<
telerik:GridViewColumn.CellStyle
>
<
Style
TargetType
=
"telerikGridView:GridViewCell"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerikGridView:GridViewCell"
>
<
CheckBox
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
IsChecked
=
"{Binding CuestionarioVisible}"
Validation.ErrorTemplate
=
"{x:Null}"
IsEnabled
=
"{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=DataContext.EditMode}"
></
CheckBox
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
telerik:GridViewColumn.CellStyle
>
</
telerik:GridViewDataColumn
>
As you can see in the code, I have binding on "IsEnabled" property for allowing or not to check on the checkboxes which was edited or not.
The binding works great in the header but, it ignores in the cell!
Any ideas? Why is that happening? Any solution for making the cells work in the same way as the header?
Thanks in advance.
Regards,
Alvaro