When I put a TextBox into a StackPanel it automatically sets its height to ensure that you can read the current font.
How can I get this behaviour in a Grid
ATM: I have the problem that the text looks different on Vista (Segoe UI, 9pt) and XP (Tahoma 8pt). I can't read the text on XP systems but can read it on vista ...
Now I always use independent values for Size, Width and Height (not pt, px or something like that) but still I have to assign a manual height to all TextBoxes (26,4 on XP).

How to make a TextBox to AutoSize in a Grid?
Lues
also, whatever container your Grid is in might have an effect on how the grid is rendered, depending on its settings.
can you post your XAML code
Martin B
JonJon
Now I'm working with FontFamily="Segeo UI" FontSize="12" on Windows XP.
I had to increase Row Height from 44 to 48.8 (20 is Margin) to display the TextBoxes correctly.
So on Longhorn a TextBox with this font displays correctly with Height 44 on XP I have to use 48.8 to see e.g. the character g correctly.
This is my General Page Style:
<Style TargetType="{x:Type TextBox}">
<Setter Property="Height" Value="28.8" />
</Style>
<Style TargetType="{x:Type Page}">
<Setter Property="FontFamily" Value="Segoe UI" />
<Setter Property="FontSize" Value="12" />
</Style>
This is my Grid ATM:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="48.8" />
<RowDefinition Height="48.8" />
<RowDefinition Height="48.8" />
<RowDefinition />
<RowDefinition Height="48.8" />
</Grid.RowDefinitions>
<TextBlock Margin="10,10,10,10" Grid.Column="0" Grid.Row="0" Text="Section Name:" />
<TextBlock Margin="10,10,10,10" Grid.Column="0" Grid.Row="1" Text="Section Language:" />
<TextBox Margin="10,10,10,10" Grid.Column="1" Grid.Row="0" Name="txtSectionName" Text="{Binding ElementName=AddSectionWindow, Path=Section.SectionName}" />
<TextBox Margin="10,10,10,10" Grid.Column="1" Grid.Row="1" Name="txtSectionLanguage" Text="{Binding ElementName=AddSectionWindow, Path=Section.SectionLanguage}" />
<StackPanel Margin="10,10,10,10" Grid.Column="1" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Margin="0,0,5,0" Name="btnAddSection" IsDefault="True" Content="Add Section" Width="120" />
<Button Name="btnCancel" Content="Cancel" IsCancel="True" Width="120" />
</StackPanel>
</Grid>
I want to get rid of the Height settings because when someone doesn't have Segeo UI it will look horrible ...
I thought WPF renders the same on all systems
Synergy
I don't think you want to set height at all. I believe the default is "Auto" which means that it will size the row to fit whatever content it contains. For example, that's how the 4th RowDefinition knows how to fit your StackPanel properly.
There is one more advanced options for sizing grid rows/columns too called "star" units, but I don't think you need those here. In case you're interested though, you can read all about Grid units here.
HTH,
Drew
shaen170013
Hello -
I've tried your example and I removed the height settings on the row's & replaced them with "Auto"; the TextBlocks and TextBoxes appeared to size correctly. Depending on how you want the Grid to resize, you can use Auto (will "stick" to the top) or * (will "stick" to the bottom & what I used below) on the third row.
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>