我正在使用 MahApp MetroWindow,它的标题模板如下所示。
<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>
最佳答案
将 Title 属性添加到窗口并在数据模板上进行模板绑定(bind)。尝试这个。
<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>
关于wpf - Mahapps Metro 窗口标题在任务栏中不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40024174/