Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You shouldn't have to go through all of that trouble. Check out my code example below. The label with <code>Text={TemplateBinding Title}</code> does what you want.</p> <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:shell="clr-namespace:Microsoft.Windows.Shell;assembly=Microsoft.Windows.Shell" Title="MainWindow" Height="350" Width="525"&gt; &lt;Window.Style&gt; &lt;Style TargetType="Window"&gt; &lt;Setter Property="shell:WindowChrome.WindowChrome"&gt; &lt;Setter.Value&gt; &lt;shell:WindowChrome GlassFrameThickness="4,40,4,4" ResizeBorderThickness="5" CaptionHeight="30"/&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="Window"&gt; &lt;Grid x:Name="PART_ComponentRoot"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="40"/&gt; &lt;RowDefinition/&gt; &lt;RowDefinition Height="4"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="4"/&gt; &lt;ColumnDefinition/&gt; &lt;ColumnDefinition Width="4"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;TextBlock Grid.Column="1" Text="{TemplateBinding Title}" HorizontalAlignment="Center" VerticalAlignment="Center"/&gt; &lt;ContentPresenter Grid.Row="1" Grid.Column="1" Content="{TemplateBinding Content}"/&gt; &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/Window.Style&gt; &lt;Grid Background="White"&gt; &lt;/Grid&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    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.
    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