10

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.

Darth_Evil
  • 591
  • 1
  • 7
  • 18

1 Answers1

45

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

punker76
  • 14,326
  • 5
  • 58
  • 96
  • I'm not seeing the drop shadow, even when I set EnableDWMDropShadow to true. I'm running on Windows 8.1, don't know if it matters. EDIT: actually the drop shadow is there, but only when the window is focused... – Thomas Levesque Oct 14 '14 at 21:29
  • @ThomasLevesque "actually the drop shadow is there, but only when the window is focused..." i think that's the windows behavior, or not? – punker76 Oct 14 '14 at 21:40
  • I don't know, but it looks weird, because the window appears to have no border at all, unless I set the BorderThickness to 1, but then it shows a dark border instead of the shadow. If I force the BorderBrush to something lighter, then it continues to show up when the drop shadow is visible. – Thomas Levesque Oct 14 '14 at 21:48
  • @ThomasLevesque you can try set `BorderBrush` and `NonActiveBorderBrush` to get what you want (>= 0.13) – punker76 Oct 14 '14 at 21:57
  • Thanks, I had not seen that property... it's not perfect, but it's a good workaround. – Thomas Levesque Oct 15 '14 at 10:16
  • `EnableDWMDropShadow` is Obsolete in the latest version – CAD bloke Apr 15 '16 at 22:21