This is a migrated thread and some comments may be shown as answers.
HorizontalAlignment of CheckBox Column
3 Answers 107 Views
This is a migrated thread and some comments may be shown as answers.
Henrique Duarte
Top achievements
Rank 1
Henrique Duarte asked on 28 Jul 2009, 01:47 PM
Hello,

How can I set the HorizontalAlignment property to "Center" of a CheckBox Column (GridViewDataColumn = boolean)?

Regards,

Henrique

3 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 29 Jul 2009, 01:59 PM
Hi Henrique Duarte,

You can achieve the desired result by using the following XAML code:

<Grid> 
    <Grid.Resources> 
        <Style x:Key="HorizontalCell" TargetType="telerik:GridViewCell">  
            <Setter Property="HorizontalContentAlignment" Value="Center"/>  
        </Style> 
        <Style x:Key="checkEditStyle" TargetType="CheckBox">  
            <Setter Property="HorizontalAlignment" Value="Center"/>  
        </Style> 
    </Grid.Resources> 
    <telerik:RadGridView Name="RadGridView1">  
        <telerik:RadGridView.Columns> 
            <telerik:GridViewDataColumn   
                DataMemberPath="MyBoolColumn"   
                CellStyle="{StaticResource HorizontalCell}">  
                <telerik:GridViewDataColumn.EditorSettings> 
                    <telerik:CheckBoxEditorSettings   
                        CellEditStyle="{StaticResource checkEditStyle}" /> 
                </telerik:GridViewDataColumn.EditorSettings> 
            </telerik:GridViewDataColumn> 
        </telerik:RadGridView.Columns> 
    </telerik:RadGridView> 
</Grid> 

Hope this helps. 

Sincerely yours,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Mark
Top achievements
Rank 1
answered on 09 Jun 2014, 02:35 PM
Sorry, but this really needs asking:  Why isn't there a HorizontalAlignment and/or HorizontalContentAlignment property on the GridViewDataColumn?
0
Yoan
Telerik team
answered on 09 Jun 2014, 04:43 PM
Hi Mark,

Actually, RadGridView's columns are not visual elements. This is why, you can't set those properties. As you already know you can use style targeting GridViewCell:
<Style x:Key="HorizontalCell" TargetType="telerik:GridViewCell"
         <Setter Property="HorizontalContentAlignment" Value="Center"/> 
</Style>
<Style x:Key="checkEditStyle" TargetType="CheckBox"
         <Setter Property="HorizontalAlignment" Value="Center"/> 
</Style>


Regards,
Yoan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Asked by
Henrique Duarte
Top achievements
Rank 1
Answers by
Milan
Telerik team
Mark
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or