2014-04-16 66 views
2

我正在使用MahApps.Metro 0.12.1开发WPF中的应用程序。在这个应用程序中,我不显示标题栏,保持可见最小化,最大化和关闭命令。下面我展示的代码:MahApps.Metro 0.13.1:显示窗口命令而不显示标题栏

<controls:MetroWindow xmlns:views="clr-namespace:View.Views" 
    xmlns:titleBar="clr-namespace:View.Views.TitleBar" 
    x:Class="View.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" 
    GlowBrush="{DynamicResource AccentColorBrush}" 
    ShowWindowCommandsOnTop="False" 
    ShowTitleBar="False" 
    Title="MainWindow" Height="400" Width="600" 
    AllowsTransparency="False"> 
<Grid> 
    ... 
</Grid> 

,当我升级到版本MathApps.Metro,在未显示这些命令0.13.1,迫使我重新建立的标题栏就会出现问题再次显示命令ShowTitleBar="True"这就是我不想要的:显示标题栏

我在查看MathApps.Metro 0.13.1的发行说明,并且报告说已对标题栏的部分进行了更改,但未提供进一步的详细信息。

我的问题是:有没有简单的方法来显示最小化,最大化和关闭命令,而不显示标题栏?做这个的最好方式是什么?

感谢

回答

3

你可以直接把窗口按钮在主窗口中这样

<Grid> 
    <!-- the window button commands --> 
    <Controls:WindowButtonCommands Panel.ZIndex="1" 
           HorizontalAlignment="Right" 
           VerticalAlignment="Top" 
           Height="{Binding TitlebarHeight, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}}" /> 

    ... 
</Grid> 

希望帮助

0

是否有显示最小化,最大化和关闭的命令,而不显示标题栏一个简单的方法?做这个的最好方式是什么?

其实不是很简单,但可能。基本上,您需要创建自己的Style模板并覆盖您的窗口的ContentPresenter

您可以查看this的问题。

除此之外,this后会指导您完成设计自己的标题栏的过程。