2014-03-24 52 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"/> 
相關問題