RadButton ContentPresenter Margin problem with Office2013 theme.

2 posts, 0 answers
  1. Eugene
    Eugene avatar
    2 posts
    Member since:
    Oct 2012

    Posted 18 Oct 2014 Link to this post

    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.

    <telerik:RadButton.Content>
     <Rectangle>
      <Rectangle.Fill>
       <DrawingBrush Stretch="Uniform">
        <DrawingBrush.Drawing>
         <GeometryDrawing Brush="Transparent" Geometry="M 25,121L 249,121L ...">
          <GeometryDrawing.Pen>
           <Pen Thickness="50" LineJoin="Round" Brush="Black"/>
          </GeometryDrawing.Pen>
         </GeometryDrawing>
        </DrawingBrush.Drawing>
       </DrawingBrush>
      </Rectangle.Fill>
     </Rectangle>
    </telerik:RadButton.Content>

    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?

    Thanks...

  2. Milena
    Admin
    Milena avatar
    201 posts

    Posted 23 Oct 2014 Link to this post

    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"/>
    </Style>

    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.
     
    Regards,
    Milena
    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top