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

How center the checkbox in the Grid using RIA?

1 Answer 15 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 01 Jul 2010, 08:33 PM
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

1 Answer, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 02 Jul 2010, 09:13 AM
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
Tags
General Discussions
Asked by
Chris
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or