locked
TextBox Default Height

    Question

  •    I have a textbox placed inside a grid with the following definition:          

    <TextBoxx:Name="textBoxProjectNumber"FontFamily="Century Gothic"FontSize="12"Grid.Row="2"Grid.Column="6"MaxHeight="24"Foreground="Black"IsSpellCheckEnabled="True"BorderThickness="0,0,0,1"BorderBrush="Black"ToolTipService.ToolTip="Enter the project number"TabIndex="21"Padding="0"Margin="0"/>

    The height of the grid's row is 24.

    The problem is that the height of the textBox keeps defaulting to 32. 

    What am I missing?

    Thank you in advance for your replies.

    Sunday, February 23, 2014 4:57 PM

Answers

  • I solved the issue....

    Even though the definition above did not show it, the properties windows had a value for Minimum Height which was set to 32. 

    Sunday, February 23, 2014 7:17 PM

All replies

  • I solved the issue....

    Even though the definition above did not show it, the properties windows had a value for Minimum Height which was set to 32. 

    Sunday, February 23, 2014 7:17 PM
  • Hi Genaro,

    Thank you for sharing the solution with us, take a look at TextBox styles and templates

    there is a line which definite the minimum height of the textbox in other resource section:

    <x:Double x:Key="TextControlThemeMinHeight">32</x:Double>

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, February 24, 2014 1:47 AM
    Moderator
  • Thank you for your answer.

    Where can I find the file that contains that code?

    Thanks again.

    Sunday, March 02, 2014 1:36 AM
  • The file is a system file, it is read-only for app, the location is: C:\Program Files (x86)\Windows Kits\8.1\Include\Winrt\Xaml\Design\generic.xaml

    However if you want to customize the TextBox mini Height, modify the textbox style, set the line

    //comment this line 
    <Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}"/>
    //comment end
    <Setter Property="MinWidth" Value="24">

    More information about how to style a control plz ref: Quickstart: Styling controls

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, March 03, 2014 9:20 AM
    Moderator