WPF and control auto size
is it possible that if i put a textbox in border container and will not specify height & width of textbox rather specify height & width for border and textbox will take the size of the border. how could i do this. i tried开发者_如何学运维 to do it in xaml but fail. need answer. thanks
http://msdn.microsoft.com/en-us/library/system.windows.horizontalalignment.stretch.aspx
It's nice and easy:
<Border Width="200" Height="70" BorderBrush="Black" BorderThickness="2">
<TextBox></TextBox>
</Border>
<Grid>
<Border Width="100" Height="100">
<TextBox />
</Border>
</Grid>
The text box will be of size of the border.
精彩评论