enable user to change checkbox?

3 posts, 1 answers
  1. Hazzard
    Hazzard avatar
    24 posts
    Member since:
    May 2006

    Posted 27 Sep 2011 Link to this post

    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. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 28 Sep 2011 Link to this post

    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 >>

  3. Hazzard
    Hazzard avatar
    24 posts
    Member since:
    May 2006

    Posted 28 Sep 2011 Link to this post

    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>
Back to Top