How do you set the width of a textbox to fill the container programmatically? For example in xaml if I have the following declaration for the textbox:
<TextBox Height="23" Name="TextBox1" VerticalAlignment="Top" Width="50" />
how can I set the width so that it fills the container in a button click handler?
You should be able to use HorizontalAlignment="Stretch"
(make sure you don't set an explicit Width
or MaxWidth
to allow dynamic sizing). I haven't done any Sliverlight development, but in WPF, that does the trick!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With