Hi there,
In our application we use in a GridView one checkBox column. We've tried to do that in two ways.
The first way, we used GridViewCheckBoxColumn, like this:
However, with this code we had two problems: first, the comboBox seems like disabled and, in the second approach we had problems to select the option (we must click three times to make a positive check).
So, we've tried yet another approach.
We've searched inn telerik´s forum and found this solution, using GridViewColumn.CellStyle.
The problem is that we use MVVM and we can´t bind Seleccionado Property, because this property is inside of control template.Can you please give us an idea of how to do it?
Thanks in advance,
Nelson
In our application we use in a GridView one checkBox column. We've tried to do that in two ways.
The first way, we used GridViewCheckBoxColumn, like this:
<
telerik:RadGridView
Name
=
"GrdParticipantesReuniao"
Background
=
"Transparent"
ItemsSource
=
"{Binding Path=DataContext.OCParticipantesReuniao,ElementName=LayoutRoot}"
BorderThickness
=
"0"
Width
=
"340"
MaxHeight
=
"300"
Margin
=
"0 10 0 0"
RowHeight
=
"20"
AutoGenerateColumns
=
"False"
SelectionMode
=
"Single"
Cursor
=
"Hand"
RowIndicatorVisibility
=
"Collapsed"
IsFilteringAllowed
=
"True"
ShowGroupPanel
=
"False"
CanUserReorderColumns
=
"False"
CanUserResizeColumns
=
"False"
ShowColumnFooters
=
"False"
ShowInsertRow
=
"False"
telerik:RadDragAndDropManager.AllowDrop
=
"True"
>
<
swi:Interaction.Triggers
>
<
swi:EventTrigger
EventName
=
"SelectionChanged"
>
<
esi:CallDataMethod
Method
=
"GrdParticipantesReuniaos_SelectionChanged"
/>
</
swi:EventTrigger
>
</
swi:Interaction.Triggers
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding FuncoesreuniaoProp.DesignacaoProp}"
Header
=
"Função"
Width
=
"0.25*"
IsReadOnly
=
"True"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding EntidadesProp,Converter={StaticResource ConcatenaTitulo}}"
Header
=
"Nome"
Width
=
"0.6*"
IsReadOnly
=
"True"
/>
<
telerik:GridViewCheckBoxColumn
DataMemberBinding
=
"{Binding Seleccionado,Mode=TwoWay}"
Header
=
"Inc."
Width
=
"0.15*"
IsReadOnly
=
"false"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
However, with this code we had two problems: first, the comboBox seems like disabled and, in the second approach we had problems to select the option (we must click three times to make a positive check).
So, we've tried yet another approach.
We've searched inn telerik´s forum and found this solution, using GridViewColumn.CellStyle.
<
telerik:RadGridView
Name
=
"GrdParticipantesReuniao"
Background
=
"Transparent"
ItemsSource
=
"{Binding Path=DataContext.OCParticipantesReuniao,ElementName=LayoutRoot}"
BorderThickness
=
"0"
Width
=
"340"
MaxHeight
=
"300"
Margin
=
"0 10 0 0"
RowHeight
=
"20"
AutoGenerateColumns
=
"False"
SelectionMode
=
"Single"
Cursor
=
"Hand"
RowIndicatorVisibility
=
"Collapsed"
IsFilteringAllowed
=
"True"
ShowGroupPanel
=
"False"
CanUserReorderColumns
=
"False"
CanUserResizeColumns
=
"False"
ShowColumnFooters
=
"False"
ShowInsertRow
=
"False"
telerik:RadDragAndDropManager.AllowDrop
=
"True"
>
<
swi:Interaction.Triggers
>
<
swi:EventTrigger
EventName
=
"SelectionChanged"
>
<
esi:CallDataMethod
Method
=
"GrdParticipantesReuniaos_SelectionChanged"
/>
</
swi:EventTrigger
>
</
swi:Interaction.Triggers
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding FuncoesreuniaoProp.DesignacaoProp}"
Header
=
"Função"
Width
=
"0.25*"
IsReadOnly
=
"True"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding EntidadesProp,Converter={StaticResource ConcatenaTitulo}}"
Header
=
"Nome"
Width
=
"0.6*"
IsReadOnly
=
"True"
/>
<
telerik:GridViewColumn
Header
=
"Check"
>
<
telerik:GridViewColumn.CellStyle
>
<
Style
TargetType
=
"telerik:GridViewCell"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:GridViewCell"
>
<
Border
Padding
=
"5,0,5,0"
BorderThickness
=
"0,0,1,1"
BorderBrush
=
"#FFB3B3B3"
>
<
CheckBox
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
IsChecked
=
"{Binding Path=DataContext.OCParticipantesReuniao.Seleccionado,Mode=TwoWay,ElementName=GrdParticipantesReuniao}"
/>
</
Border
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
telerik:GridViewColumn.CellStyle
>
</
telerik:GridViewColumn
>
The problem is that we use MVVM and we can´t bind Seleccionado Property, because this property is inside of control template.Can you please give us an idea of how to do it?
Thanks in advance,
Nelson