Henrique Duarte
Top achievements
Rank 1
Veteran
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
How can I set the HorizontalAlignment property to "Center" of a CheckBox Column (GridViewDataColumn = boolean)?
Regards,
Henrique
3 Answers, 1 is accepted
0
Hi Henrique Duarte,
You can achieve the desired result by using the following XAML code:
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.
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
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:
Regards,
Yoan
Telerik
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.