WPF应用程序中的Metro风格_包差异

时间:2014-03-24 11:10:06

标签: wpf microsoft-metro

我想创建一个metro风格的应用程序,我做了一些研究,我发现了很多关于它的文章和教程。

但我仍然需要在Modern UI for WPFElysiumMahApps之间进行明确比较。

测试所有这些花费了太多时间!我需要学习各自的功能,以决定从哪一个开始。

谢谢,

1 个答案:

答案 0 :(得分:1)

首先:Download the WPF Shell Integration Library Here

然后使用此XML代码:

<Window x:Class="MyLibrary.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:shell="http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell"
        Title="MainWindow"
        WindowStyle="SingleBorderWindow"
        ResizeMode="CanResizeWithGrip"
        mc:Ignorable="d"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        d:DesignHeight="449"
        d:DesignWidth="677"
        Foreground="White"
        removed="Black">

    <shell:WindowChrome.WindowChrome>
        <shell:WindowChrome CaptionHeight="35"
                            GlassFrameThickness="0,0,0,1"
                            ResizeBorderThickness="5" />
    </shell:WindowChrome.WindowChrome>

    <Grid x:Name="LayoutRoot">

    </Grid>
</Window>

(注意,你需要引用Microsoft.Windows.Shell)

这是最好的方法..它适用于所有Windows版本。

修改 如果你想在窗口顶部添加标题按钮,请将此XAML代码添加到顶部的任何控件:(按钮为例)

<button shell:WindowChrome.IsHitTestVisibleInChrome="True"/>