2014-03-24 54 views
0

我想创建一个metro风格的应用程序,我做了一些研究,并且发现了大量有关这方面的文章和教程。WPF应用程序中的Metro风格_包差异

但我仍然需要清楚比较Modern UI for WPF,ElysiumMahApps

测试所有这些需要太多时间!我需要了解每个人的特点,决定从哪一个开始。

感谢,

回答

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"/> 
相关问题