Search code examples
wpfxamltaskbartitlebarmahapps.metro

Mahapp Metro Window Title not visible in TaskBar


I am using MahApp MetroWindow which has a title template like below.

<metro:MetroWindow x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"        
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:metro="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
    xmlns:local="clr-namespace:WpfApplication1">
<metro:MetroWindow.TitleTemplate>
    <DataTemplate>
        <Grid>
            <TextBlock Text="New Title"/>
        </Grid>
    </DataTemplate>
</metro:MetroWindow.TitleTemplate>

Issue is in Taskbar it doesent show the title. enter image description here


Solution

  • Add Title property to window and do templatebinding on the datatemplate. Try this.

     <metro:MetroWindow x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"        
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:metro="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:local="clr-namespace:WpfApplication1"
    Title="New Title">
    <metro:MetroWindow.TitleTemplate>
        <DataTemplate>
            <Grid>
                <TextBlock Text="{TemplateBinding Content}"/>
            </Grid>
        </DataTemplate>
    </metro:MetroWindow.TitleTemplate>