How center the checkbox in the Grid using RIA?

2 posts, 1 answers
  1. Chris
    Chris avatar
    53 posts
    Member since:
    Oct 2012

    Posted 01 Jul 2010 Link to this post

    Hi,

               Problem:
                         How to center the checkbox on the grid? Since I'm using RIA to populate it.   
                         Is there a way or this is a limitation?


                 Please help...

    Thanks,
    Chris
  2. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 02 Jul 2010 Link to this post

    Hi Chris,

    There is no limitation when setting the position of a CheckBox in the grid. All you need to do is to predefine your CellStyle. You can create it as:

    <telerik:GridViewDataColumn IsReadOnly="True" Header="Id" DataMemberBinding="{Binding ProductId}">
                        <telerik:GridViewDataColumn.CellStyle>
                            <Style TargetType="telerik:GridViewCell">
                                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                            </Style>
                        </telerik:GridViewDataColumn.CellStyle>                    
                   </telerik:GridViewDataColumn>

    or in case you need a more complex structure:
    <telerik:GridViewDataColumn IsReadOnly="True" Header="Id">
                         <telerik:GridViewDataColumn.CellStyle>
                         <Style TargetType="telerik:GridViewCell">
                            <Setter Property="HorizontalContentAlignment"                         Value="Center"/>
                         </Style>
                         </telerik:GridViewDataColumn.CellStyle>
                         <telerik:GridViewDataColumn.CellTemplate>
                             <DataTemplate>
                                 <TextBlock VerticalAlignment="Top"                         Text="{Binding ProductId}"/>
                             </DataTemplate>
                         </telerik:GridViewDataColumn.CellTemplate>
    </telerik:GridViewDataColumn>

     

    Kind regards,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top