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

enable user to change checkbox?

2 Answers 54 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hazzard
Top achievements
Rank 1
Hazzard asked on 27 Sep 2011, 11:19 PM

given my xaml below, what do I need to add in order for the CheckboxColumn to be enabled and allow for the user to change the value? Thank you.

<Grid>
   <telerik:RadGridView Name="rgvPSEProductInfo"   IsReadOnly="True"        SelectionChanged="rgvPSEProductInfo_SelectionChanged"  AutoGenerateColumns="False" >
     <telerik:RadGridView.Columns>
           <telerik:GridViewCheckBoxColumn   DataMemberBinding="{Binding bIsChecked}" IsReadOnly="False"   Header="Item Completed" TextWrapping="Wrap" HeaderTextAlignment="Center" IsVisible="True" Width="60" >
           <telerik:GridViewCheckBoxColumn.CellStyle>
                 <Style TargetType="telerik:GridViewCell">
                       <Setter Property="HorizontalContentAlignment" Value="Center" />
                  </Style>
           </telerik:GridViewCheckBoxColumn.CellStyle>
      </telerik:GridViewCheckBoxColumn>
             </telerik:RadGridView.Columns>
         </telerik:RadGridView>
 </Grid>

2 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 28 Sep 2011, 07:00 AM
Hi Greg Hazzard,

You can define a CellTemplate for a column and place a CheckBox inside. For example:

<telerik:GridViewDataColumn DataMemberBinding="{Binding BIsChecked}" Header="Item Completed"
                                                HeaderTextAlignment="Center" Width="60">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding BIsChecked, Mode=TwoWay}" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>

Thus no matter that your RadGridView is read-only, you will be able to edit the value of boolean property.
I am attaching a sample project that you can use for a reference.
  All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Hazzard
Top achievements
Rank 1
answered on 28 Sep 2011, 05:46 PM

Thank you Maya.
Got it.  I was using some bad xaml.
This works.

<telerik:GridViewDataColumn DataMemberBinding="{Binding BIsChecked}" Header="Item Completed" 
        HeaderTextAlignment="Center" Width="60">
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" />
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
Tags
GridView
Asked by
Hazzard
Top achievements
Rank 1
Answers by
Maya
Telerik team
Hazzard
Top achievements
Rank 1
Share this question
or