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

Increase padding to SelectionBackground

3 Answers 49 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
felix
Top achievements
Rank 1
felix asked on 03 Feb 2011, 01:41 PM
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

3 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 04 Feb 2011, 08:23 AM
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>>
0
felix
Top achievements
Rank 1
answered on 04 Feb 2011, 01:51 PM
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.

0
Accepted
Dani
Telerik team
answered on 07 Feb 2011, 10:57 AM
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>>
Tags
DateTimePicker
Asked by
felix
Top achievements
Rank 1
Answers by
Dani
Telerik team
felix
Top achievements
Rank 1
Share this question
or