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

RadButton ContentPresenter Margin problem with Office2013 theme.

1 Answer 103 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Eugene asked on 18 Oct 2014, 02:35 PM
The content size becomes too small in the RadButton when I use Office2013 theme. (Telerik WPF library version 2014.2.729.45)
The content of the RadButton is an image by DrawingBrush (Please refer to following code snippet.),
the image is shown nicely with any themes except for Office2013.

   <DrawingBrush Stretch="Uniform">
     <GeometryDrawing Brush="Transparent" Geometry="M 25,121L 249,121L ...">
       <Pen Thickness="50" LineJoin="Round" Brush="Black"/>

When I checked out with the Snoop tool, I learned the ContentPresenter Margin of the RadButton is a little big so the image was pushed in then it became small.
I explicitly set the height and width of the Rectagle to fix the image size though, the image was chopped out because the area was not large enough to display the whole image.

So is there a way to keep the image size consistent when Office2013 theme is selected?


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 23 Oct 2014, 06:13 AM
Hi Eugene,

In Office2013 theme the Margin property of ContentPresenter  is bound to the Padding property of RadButton. So I suggest that you update Padding property of your button to unsure that the image is not chopped.  

If you change the themes at runtime, then you can add a style for the button in a Resource Dictionary which you can merge when you set Office2013 theme: 
<Style x:Key="RadButtonStyle" TargetType="telerik:RadButton" BasedOn="{StaticResource RadButtonStyle}">
       <Setter Property="Padding" Value="0"/>

Afterthat you need to call it with DynamicResource in order the style to be changed at runtime.

I hope this information will help you and don't hesitate to write back if you have more questions.

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.

Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question