Note that there are some explanatory texts on larger screens.

plurals
  1. POViewbox containing a TextBlock seems to have minimum height
    primarykey
    data
    text
    <p>I'm trying to build a UI layout in WPF that can scale with the size of the window. The idea is to have a number of controls on the left, a number of controls on the right, and in the middle, have a line of text. It's OK if the line of text is cropped on the right. The main thing is that the aspect ratio of all of the controls is maintained.</p> <p>That part is working fine. The problem is that the center line of text seems to have a minimum height; below this height, it will start clipping vertically. I want the text to keep shrinking if I make the window very thin. Even manually setting the <code>FontSize</code> on the <code>TextBlock</code> doesn't work.</p> <p>Note that the controls on the left and right do not have a minimum width; they can shrink indefinitely.</p> <p>My XAML is here. I'm using .NET 4.0.</p> <pre><code>&lt;Window x:Class="TestWpfApp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="75" Width="525"&gt; &lt;Grid&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="Auto"/&gt; &lt;ColumnDefinition Width="1*"/&gt; &lt;ColumnDefinition Width="Auto"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Viewbox Grid.Column="0" Stretch="UniformToFill" Margin="2"&gt; &lt;Grid&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition/&gt; &lt;ColumnDefinition/&gt; &lt;ColumnDefinition/&gt; &lt;ColumnDefinition/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Button Grid.Column="0" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center"&gt;A&lt;/Button&gt; &lt;Button Grid.Column="1" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center"&gt;B&lt;/Button&gt; &lt;Button Grid.Column="2" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center"&gt;C&lt;/Button&gt; &lt;Button Grid.Column="3" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center"&gt;D&lt;/Button&gt; &lt;/Grid&gt; &lt;/Viewbox&gt; &lt;Viewbox VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Column="1" Stretch="UniformToFill" Margin="2"&gt; &lt;TextBlock&gt;Here is a bunch of text that may prove to be interesting.&lt;/TextBlock&gt; &lt;/Viewbox&gt; &lt;Viewbox Grid.Column="2" Stretch="UniformToFill" Margin="2"&gt; &lt;Button HorizontalAlignment="Center"&gt;X&lt;/Button&gt; &lt;/Viewbox&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre>
    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