Increase padding to SelectionBackground

4 posts, 1 answers
  1. felix
    felix avatar
    16 posts
    Member since:
    Nov 2010

    Posted 03 Feb 2011 Link to this post

    Hi,

    Is it possible to increase the padding to the SelectionBackground? When text is highlighted, there is a 1px padding around the selected text, the design I am working to has a 4px padding surround.

    Any help appreciated!

    Felix
  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 04 Feb 2011 Link to this post

    Hello Felix,

    You can easily increasing the padding in the control by applying a simple Style:

    <UserControl
        x:Class="SilverlightApplication1.MainPage"
        Width="640" Height="480">
        <UserControl.Resources>
            <Style x:Key="RadDateTimePickerStyle1" TargetType="telerik:RadDateTimePicker">
                <Setter Property="Padding" Value="4" /> 
            </Style>
        </UserControl.Resources>
      
        <Grid x:Name="LayoutRoot" Background="White">
            <telerik:RadDateTimePicker  Width="200" Margin="50" Style="{StaticResource RadDateTimePickerStyle1}" VerticalAlignment="Top"/>
        </Grid>
    </UserControl>

    If you wish to do that only for the Focus state of the control, you need to do the following: generate the template of RadDateTimePicker by going to Object > Edit Template > Edit a Copy in Blend. Inside the RadDateTimePickerStyle, provide a new value for the PART_DateTimeInput element while in the Focus VisualState.

     
    I hope this helps.

    All the best,
    Dani
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. felix
    felix avatar
    16 posts
    Member since:
    Nov 2010

    Posted 04 Feb 2011 Link to this post

    Hi there,

    thanks for the response. The padding only affects the area between the text and the edge of the control, I need to increase the padding between the text and the selectionforeground shown in this image by the pink and blue lines.

  5. Answer
    Dani
    Admin
    Dani avatar
    848 posts

    Posted 07 Feb 2011 Link to this post

    Hi Felix,

    Thank you for the clarification.

    Unfortunately, you cannot change the size of the selection background. It is related to changing the default Windows caret height of the TextBox. The caret height is propertional to the font size of the input text and is not available for free modification.

    The only customizable property of the caret would be its color  - you could set a telerik:RadWatermarkTextBox .Caret brush once you have generated the template of RadDateTimePicker.

    Regards,
    Dani
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top