10 Answers, 1 is accepted
0
Accepted
Hello Ristogod,
You can use a Style to achieve that:
Hope this helps.
Sincerely yours,
Veselin Vasilev
the Telerik team
You can use a Style to achieve that:
<
telerik:GridViewCheckBoxColumn
DataMemberBinding
=
"{Binding IsActive}"
>
<
telerik:GridViewCheckBoxColumn.CellStyle
>
<
Style
TargetType
=
"telerik:GridViewCell"
>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Center"
/>
</
Style
>
</
telerik:GridViewCheckBoxColumn.CellStyle
>
</
telerik:GridViewCheckBoxColumn
>
Hope this helps.
Sincerely yours,
Veselin Vasilev
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
0
1
Hello LM IT,
You should inherit the base style and override only HorizontalContentAlignment property of the cell, as proposed below:
Regards,
Vanya Pavlova
Telerik
You should inherit the base style and override only HorizontalContentAlignment property of the cell, as proposed below:
<
telerik:RadGridView
ItemsSource
=
"{Binding Collection}"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewCheckBoxColumn
>
<
telerik:GridViewCheckBoxColumn.CellStyle
>
<
Style
TargetType
=
"telerik:GridViewCell"
BasedOn
=
"{StaticResource GridViewCellStyle}"
>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Center"
/>
</
Style
>
</
telerik:GridViewCheckBoxColumn.CellStyle
>
</
telerik:GridViewCheckBoxColumn
>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
Regards,
Vanya Pavlova
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.
0
Warren
Top achievements
Rank 1
answered on 11 Nov 2014, 04:25 PM
I experienced this same behavior when switching to Implicit Themes. It appears that the advice provided on this page doesn't apply to implicit theming. Even the offset is now broken and I had to switch the -3 to -10 without filtering enabled, and -11 with filtering enabled. This seems like a bad solution. So you have any additional insight?
0
Hi Warren,
Thank you for contacting us.
I'm not quite sure, that I understand your points correctly.
Can you please elaborate a bit more?
Regards,
Vanya Pavlova
Telerik
Thank you for contacting us.
I'm not quite sure, that I understand your points correctly.
Can you please elaborate a bit more?
Regards,
Vanya Pavlova
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Warren
Top achievements
Rank 1
answered on 08 Dec 2014, 06:47 PM
Hi Vanya,
The linked article from my post describes how to keep a checkbox centered in a column when you enter "edit" mode. The relevant code is this:
However, once I moved to implicit styles, entering edit mode the checkbox began to shift again with that margin applied. I had to modify the amount of margin, and even had to modify it depending on what controls are showing in the header (like the filter when filtering is turned on). This seems fragile to me. I'm wondering if there is a better way. Depending on the situation I am using a -10 or -11 instead of a -3.
The linked article from my post describes how to keep a checkbox centered in a column when you enter "edit" mode. The relevant code is this:
checkBox.Margin =
new
Thickness(4, 0, -3, 0);
However, once I moved to implicit styles, entering edit mode the checkbox began to shift again with that margin applied. I had to modify the amount of margin, and even had to modify it depending on what controls are showing in the header (like the filter when filtering is turned on). This seems fragile to me. I'm wondering if there is a better way. Depending on the situation I am using a -10 or -11 instead of a -3.
0
Hi Warren,
I would like to ask you which Telerik theme you are currently using?
Regards,
Vanya Pavlova
Telerik
I would like to ask you which Telerik theme you are currently using?
Regards,
Vanya Pavlova
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Warren
Top achievements
Rank 1
answered on 11 Dec 2014, 03:44 PM
I am using the Office2013 theme.
0
Hello Warren,
Thank you for getting back to us.
GridViewCheckBoxColumn internally applies some Margin to the CheckBox based on particular theme.
Since you are trying to center the cell content, when you enter edit mode the CheckBox element jumps to the left. For the time being I suggest you to apply the Margin of the CheckBox in the way you proposed.
Regards,
Vanya Pavlova
Telerik
Thank you for getting back to us.
GridViewCheckBoxColumn internally applies some Margin to the CheckBox based on particular theme.
Since you are trying to center the cell content, when you enter edit mode the CheckBox element jumps to the left. For the time being I suggest you to apply the Margin of the CheckBox in the way you proposed.
Regards,
Vanya Pavlova
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Toffer
Top achievements
Rank 2
answered on 19 Feb 2016, 10:19 PM
Thx Vanya. The "BasedOn" part fixed me right up. :)