Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using MahApps Metro theme VS2013

I'm trying to do the Getting Started instructions here: http://mahapps.com/MahApps.Metro/guides/quick-start.html.

I've gotten the latest pre-release (tried with stable too), I'm not getting the same window the guide is producing. I'm getting a transparent window and titlebar, so it looks like a floating titlebar, and minimize, maximize and close buttons.

When I add the styling I get a white background with a blue titlebar, but no shadow. Am I doing something wrong here or has anyone else experienced this?

Thanks.

EDIT: here's the XAML

Main Window

<Controls:MetroWindow x:Class="Metro.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" 
    Title="MainWindow" Height="900" Width="1600">
</Controls:MetroWindow>

App.xaml

<Application x:Class="Metro.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         StartupUri="MainWindow.xaml">
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

As I mentioned, I followed the getting started instructions, I copy and pasted the exact same code, and got a different result.

like image 708
Darth_Evil Avatar asked Mar 08 '14 05:03

Darth_Evil


1 Answers

EDIT The quick start guide and the MetroWindow help now updated (04.09.2014).

The screenhots/examples at the quickstart are not quite updated.

You can have a border

<controls:MetroWindow x:Class="MahApps.Metro.Simple.Demo.MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                      Title="MainWindow"
                      Height="200"
                      Width="600"

                      BorderBrush="{DynamicResource AccentColorBrush}"
                      BorderThickness="1"

                      WindowStartupLocation="CenterScreen">

</controls:MetroWindow>

enter image description here

or a glow border

<controls:MetroWindow x:Class="MahApps.Metro.Simple.Demo.MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                      Title="MainWindow"
                      Height="200"
                      Width="600"

                      GlowBrush="{DynamicResource AccentColorBrush}"

                      WindowStartupLocation="CenterScreen">

</controls:MetroWindow>

enter image description here

or a drop shadow

<controls:MetroWindow x:Class="MahApps.Metro.Simple.Demo.MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                      xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                      xmlns:behaviours="http://metro.mahapps.com/winfx/xaml/shared"
                      Title="MainWindow"
                      Height="200"
                      Width="600"
                      ResizeMode="CanResizeWithGrip"
                      WindowTransitionsEnabled="False"
                      WindowStartupLocation="CenterScreen">

  <i:Interaction.Behaviors>
    <behaviours:BorderlessWindowBehavior AllowsTransparency="False"
                                         EnableDWMDropShadow="True" />
    <behaviours:WindowsSettingBehaviour />
    <behaviours:GlowWindowBehavior />
  </i:Interaction.Behaviors>

</controls:MetroWindow>

Update

EnableDWMDropShadow has been moved to MetroWindow in version 0.13 alpha (latest version)

<controls:MetroWindow x:Class="MahApps.Metro.Simple.Demo.MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                      xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                      xmlns:behaviours="http://metro.mahapps.com/winfx/xaml/shared"
                      Title="MainWindow"
                      Height="200"
                      Width="600"

                      EnableDWMDropShadow="True"
                      ResizeMode="CanResizeWithGrip"

                      WindowTransitionsEnabled="False"
                      WindowStartupLocation="CenterScreen">

</controls:MetroWindow>

enter image description here

hope that helps

like image 169
punker76 Avatar answered Oct 07 '22 00:10

punker76