Changing Height of a RadDateTimePicker Control

2 posts, 0 answers
  1. Richard
    Richard avatar
    10 posts
    Member since:
    Dec 2007

    Posted 05 Dec 2008 Link to this post

    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?

  2. Martin Vasilev
    Martin Vasilev avatar
    1061 posts

    Posted 08 Dec 2008 Link to this post

    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 =   
        ((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.
Back to Top