Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In a WPF Grid, <code>Width="*"</code> or <code>Height="*"</code> means proportional sizing.<br> For example: to give 30% to column 1 and 70% to column 2 -</p> <pre><code>&lt;ColumnDefinition Width="3*" /&gt; &lt;ColumnDefinition Width="7*" /&gt; </code></pre> <p><img src="https://i.stack.imgur.com/cfmC3.png" alt="enter image description here"></p> <p>And likewise for rows -</p> <pre><code>&lt;RowDefinition Height="3*" /&gt; &lt;RowDefinition Height="7*" /&gt; </code></pre> <p>The numbers do not have to be integers.<br> If the Width for RowDefinition (Height for ColumnDefinition) is omitted, 1* is implied.<br> In this example, column 1 is 1.5 times wider than column 2 -</p> <pre><code>&lt;ColumnDefinition Width="1.5*" /&gt; &lt;ColumnDefinition /&gt; </code></pre> <p><img src="https://i.stack.imgur.com/7K7XH.png" alt="Column 1: 1.5*, Column 2 1* (implied)"></p> <p>You can mix auto-fit and fixed widths with * (proportional) widths; in that case the * columns are apportioned to the remainder after the auto-fit and fixed widths have been calculated - </p> <pre><code>&lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="Auto" /&gt; &lt;!-- Auto-fit to content, 'Hi' --&gt; &lt;ColumnDefinition Width="50.5" /&gt; &lt;!-- Fixed width: 50.5 device units) --&gt; &lt;ColumnDefinition Width="69*" /&gt; &lt;!-- Take 69% of remainder --&gt; &lt;ColumnDefinition Width="31*"/&gt; &lt;!-- Take 31% of remainder --&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;TextBlock Text="Hi" Grid.Column="0" /&gt; </code></pre> <p><img src="https://i.stack.imgur.com/uEIAp.png" alt="enter image description here"></p>
 

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