Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy two columns in a WPF Grid with * do not have the same size?
    primarykey
    data
    text
    <p>with the following code I expected to end with two ListBox with the same Width as they are into two columndefinition with With="*"</p> <p>Instead of this looks like the size is determined from the size of the text up the ListBox which does not make sense as this text is much smaller than the ListBox and thus the TextBlock has enough space to accommodate the text.</p> <pre><code>&lt;Window x:Class="UnderstandSizing.Window5" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window5" SizeToContent="WidthAndHeight" ResizeMode="NoResize" &gt; &lt;Grid&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;ColumnDefinition Width="Auto" /&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;TextBlock Text="Text1longer" Grid.Row="0" Grid.Column="0" x:Name="Test1" /&gt; &lt;TextBlock Text="Text1" Grid.Row="0" Grid.Column="2" /&gt; &lt;ListBox Grid.Row="1" Grid.Column="0" Height="150" /&gt; &lt;ListBox Grid.Row="1" Grid.Column="2" Height="150" /&gt; &lt;TextBlock Grid.Row="2" Grid.ColumnSpan="3" Text="This textblock sets the max width" Width="300" /&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre> <p><img src="https://i.stack.imgur.com/dL6wb.png" alt="enter image description here"></p> <p>The WPF automatic sizing feature is driving me mad ... any ideas? Thanks.</p> <p>EDIT: Everything done in VS2008, just in case it matters.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload