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

Changing Height of a RadDateTimePicker Control

1 Answer 428 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 05 Dec 2008, 05:52 PM
I have a RadDateTimePicker control that is located to the right of a RadTextBox.  The default height of a RadTextBox is 20 and the default height of a RadDateTimePicker control is 22.  There's also a discrepancy in heights with the combobox, the default height for it is 19.  The difference in heights although small is very noticeable when the controls are arranged horizontally.

I can change the height of the combo box to match a text box and so I can get it to match.  However, when I reduce the Height of a DateTimePicker to 20 (after setting AutoSize to false), it looks funny.  Worse, when I run the application, the height of a RadDateTimePicker seems to be reset to 22 no matter what I've tried to do.

I know that the control height is a function of the control font.  I tried reducing the font of the date time picker and that does get the control heights to match.  However, mixing fonts across controls looks worse than the size discrepancy.

Are there any good workarounds for this so that I can get the RadDateTimePicker height to match the text and combo boxes?

Thanks,
Richard

1 Answer, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 08 Dec 2008, 05:01 PM
Hello Richard,

Thank you for writing.

You could adjust the height of RadDateTimePicker by setting a minimum size and changing FitToSizeMode of its RadMaskedEditBoxItem . Please review the code-block below:
 
private void SetHeight(RadDateTimePicker dateTimePicker, int height)  
{  
    dateTimePicker.MinimumSize = new Size(0, height);  
    ((RadMaskedEditBoxItem)dateTimePicker.DateTimePickerElement.Children[1].Children[2].Children[0]).FitToSizeMode =   
        Telerik.WinControls.RadFitToSizeMode.FitToParentBounds;  
    ((FillPrimitive)dateTimePicker.DateTimePickerElement.Children[0]).BackColor = SystemColors.ControlLightLight;  

I have to agree that you are right about that RadDateTimePicker should has the same height as the other controls such as RadTextBox and RadComboBox by default. We will consider changing this in one of the next releases.

I have updated your Telerik points for bringing our attention on this.

If you have other questions, do not hesitate to contact me again.

Kind regards,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Richard
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question
or