Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF Layout: word-wrapping not working
    text
    copied!<p>Why does the text in my TextBlock extend out to the right beyond my canvas even though I specified word wrap?</p> <pre><code>&lt;Window x:Class="WpfApplication6.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" SizeToContent="WidthAndHeight"&gt; &lt;DockPanel&gt; &lt;StackPanel DockPanel.Dock="Top" Orientation="Horizontal"&gt; &lt;Button Content="111"/&gt; &lt;Button Content="222"/&gt; &lt;Button Content="333"/&gt; &lt;Button Content="444"/&gt; &lt;Button Content="555"/&gt; &lt;/StackPanel&gt; &lt;StackPanel DockPanel.Dock="Left"&gt; &lt;Button Content="One"/&gt; &lt;Button Content="Two"/&gt; &lt;Button Content="Three"/&gt; &lt;Button Content="Four"/&gt; &lt;Button Content="Five"/&gt; &lt;/StackPanel&gt; &lt;Canvas Background="tan"&gt; &lt;TextBlock TextWrapping="Wrap"&gt;This is the content in this area here&lt;/TextBlock&gt; &lt;/Canvas&gt; &lt;/DockPanel&gt; &lt;/Window&gt; </code></pre> <p><strong>SOLUTION: Thanks, Steve, that did it, I added a ScrollViewer as well, nice:</strong></p> <pre><code>&lt;DockPanel&gt; &lt;StackPanel DockPanel.Dock="Top" Orientation="Horizontal"&gt; &lt;Button Content="111"/&gt; &lt;Button Content="222"/&gt; &lt;Button Content="333"/&gt; &lt;Button Content="444"/&gt; &lt;Button Content="555"/&gt; &lt;/StackPanel&gt; &lt;StackPanel DockPanel.Dock="Left"&gt; &lt;Button Content="One" Click="Button_Click" /&gt; &lt;Button Content="Two"/&gt; &lt;Button Content="Three"/&gt; &lt;Button Content="Four"/&gt; &lt;Button Content="Five"/&gt; &lt;/StackPanel&gt; &lt;Grid Background="tan"&gt; &lt;ScrollViewer&gt; &lt;TextBlock Name="mainArea" Padding="10" TextWrapping="Wrap"&gt;This is the content in this area here&lt;/TextBlock&gt; &lt;/ScrollViewer&gt; &lt;/Grid&gt; &lt;/DockPanel&gt; </code></pre>
 

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