WPF layout - letting a child control width size to fit and limiting its max value
sorry for the naive question but this seems a good starting point for learning more about WPF layout: say I have a UserControl whose layout has a grid with 1 row x 3 columns, the first 2 autosized and the third star-sized:

    <Grid>
    <Grid.RowDefinitions>
    		<RowDefinition/>
    	</Grid.RowDefinitions>
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition Width="Auto"/>
    		<ColumnDefinition Width="Auto"/>
    		<ColumnDefinition />
    	</Grid.ColumnDefinitions>
    	<ComboBox MinWidth="80" MaxWidth="150" .../>
    	<CheckBox Grid.Column="1" VerticalAlignment="Top".../>
    	<TextBox Grid.Column="2" MaxHeight="400" TextWrapping="Wrap"...>
    </Grid>

The TextBox has text wrapping and its vertical scrollbar visibility set to auto and its horizontal one hidden.

Now, I have some window including a ListBox whose items are instances of this UserControl, like:

    <ListBox HorizontalContentAlignment="Stretch".../>

The ListBox is in a 1-column star-sized grid and thus stretches to fit all the available width in its container. Now, when I resize the ListBox with my mouse, I'd want the third column of the UserControl and its content (the TextBox) to resize so that:

a) it fits all the available space to the right side of the window;

b) the TextBox in that column should not automatically increase its width when I type into it some long text: it should just wrap, increasing its height (up to a maximum height; then the vertical scrollbar will appear). In other words, its MaxWidth should be determined by the available space, like its Width.

How should I code my XAML for this?

WPF layout - letting a child control width size to fit and limiting its max value
===

sorry for the naive question but this seems a good starting point for learning more about WPF layout: say I have a UserControl whose layout has a grid with 1 row x 3 columns, the first 2 autosized and the third star-sized:

    <Grid>
    <Grid.RowDefinitions>
    		<RowDefinition/>
    	</Grid.RowDefinitions>
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition Width="Auto"/>
    		<ColumnDefinition Width="Auto"/>
    		<ColumnDefinition />
    	</Grid.ColumnDefinitions>
    	<ComboBox MinWidth="80" MaxWidth="150" .../>
    	<CheckBox Grid.Column="1" VerticalAlignment="Top".../>
    	<TextBox Grid.Column="2" MaxHeight="400" TextWrapping="Wrap"...>
    </Grid>

The TextBox has text wrapping and its vertical scrollbar visibility set to auto and its horizontal one hidden.

Now, I have some window including a ListBox whose items are instances of this UserControl, like:

    <ListBox HorizontalContentAlignment="Stretch".../>

The ListBox is in a 1-column star-sized grid and thus stretches to fit all the available width in its container. Now, when I resize the ListBox with my mouse, I'd want the third column of the UserControl and its content (the TextBox) to resize so that:

a) it fits all the available space to the right side of the window;

b) the TextBox in that column should not automatically increase its width when I type into it some long text: it should just wrap, increasing its height (up to a maximum height; then the vertical scrollbar will appear). In other words, its MaxWidth should be determined by the available space, like its Width.

How should I code my XAML for this?
