简体   繁体   中英

How to get Drop Shadow Effect on Metrowindow WPF

I am using a Metrowindow as my main Window.xaml for my application. However, after trying different results from Google I still can't manage to get my window to drop a shadow effect.

My Code:

Window.xaml

<Metro:MetroWindow x:Class="ROGERS.Windows.Window"
                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                   xmlns:local="clr-namespace:ROGERS.Windows"
                   xmlns:ViewModels="clr-namespace:ROGERS.Windows.ViewModels"
                   xmlns:Views="clr-namespace:ROGERS.Windows.Views"
                   xmlns:Metro="http://metro.mahapps.com/winfx/xaml/controls"
                   xmlns:MetroIcons="http://metro.mahapps.com/winfx/xaml/iconpacks"
                   mc:Ignorable="d"
                   TitleAlignment="Center"
                   TitlebarHeight="26"
                   Height="800" 
                   Width="1440"
                   ShowIconOnTitleBar="False"
                   WindowStartupLocation="CenterScreen"
                   WindowTitleBrush= "#0c3868"
                   BorderBrush="#0c3868"
                   WindowStyle="None"
                   BorderThickness="1"
                   AllowsTransparency="False"
                   Closing="MetroWindow_Closing">

    <Metro:MetroWindow.Effect>
        <DropShadowEffect Color="Black" BlurRadius="20" Direction="90" RenderingBias="Quality" ShadowDepth="3"/>
    </Metro:MetroWindow.Effect>
   

    <Metro:MetroWindow.DataContext>
        <ViewModels:WindowViewModel />
    </Metro:MetroWindow.DataContext>


    <Frame Source="Views/ReportGenerator.xaml" x:Name="ReportGeneratorFrame" />
</Metro:MetroWindow>

Anyone knows how to get the effect?

The docs for MetroWindow explain how to do it using the GlowBrush property.

https://mahapps.com/docs/controls/metrowindow

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM