Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Textbox AutoSize?

 
 
Old 04-01-2007   #1 (permalink)
everydaypanos


 
 

Textbox AutoSize?

Hi,
I have a Grid with this code in it:

<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="100" Width="100"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

In the second column lies a text box.

Q: How can I fill the second column with the Textbox? When I put
TextBox->Width="Auto"
And
TextBox->HorizontalAlignment="Stretch"
I just get a huge TextBox because it is adjusted based on the Text
inside the TextBox...

I am new in this, so please give me smt. Even a whole new approach
would be fine. I just want it to work.


My System SpecsSystem Spec
Old 04-05-2007   #2 (permalink)
Plamen Ratchev


 
 

Re: Textbox AutoSize?

Do you mean to have the TextBox with normal height, not filling the whole
grid row? If so, then you can just set the proper height for the TextBox or
host the TextBox in another parent container like StackPanel:

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="100" Width="100"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBox Grid.Column="1" Grid.Row="0" Width="Auto"
HorizontalAlignment="Stretch"/>
<TextBox Grid.Column="1" Grid.Row="1" Height="22" Width="Auto"
HorizontalAlignment="Stretch"/>
<StackPanel Grid.Column="1" Grid.Row="2">
<TextBox Width="Auto" HorizontalAlignment="Stretch"/>
</StackPanel>
</Grid>

The first TextBox will fill the first row of the grid, the second will have
the set height, and the third will have normal height because it is hosted
in the StackPanel.

HTH,

Plamen Ratchev
http://www.SQLStudio.com



My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
split textbox VB Script
no textbox for password Vista account administration
"Format-Table -autosize" as default PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46