我正在尝试在WPF应用程序的主窗口上创建外部发光效果。
这是主窗口的XAML:
<Window x:Class="UITestA.MainWindow"
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:shell="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="clr-namespace:UITestA"
mc:Ignorable="d"
WindowStyle="None"
AllowsTransparency="True"
ResizeMode="CanResizeWithGrip"
WindowStartupLocation="CenterScreen"
Background="#FF302C2C"
Title="MainWindow" Height="450" Width="800" MouseDown="Window_MouseDown">
<Window.Effect>
<DropShadowEffect Color="Black" BlurRadius="20" Direction="-90" RenderingBias="Quality" ShadowDepth="4"/>
</Window.Effect>
<Window.Style>
<Style TargetType="{x:Type Window}">
<Setter Property="shell:WindowChrome.WindowChrome">
<Setter.Value>
<shell:WindowChrome ResizeBorderThickness="4" CaptionHeight="35" CornerRadius="0" GlassFrameThickness="0"/>
</Setter.Value>
</Setter>
</Style>
</Window.Style>
<Grid Background="#FF302C2C" >
<Grid VerticalAlignment="Top" Background="#FF4D4848">
<StackPanel Height ="35" WindowChrome.IsHitTestVisibleInChrome="True" VerticalAlignment="Center" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Width="35" Name="MinimizeButton" Style="{StaticResource CaptionButtonMinMax}">
<Image Source="{StaticResource pngMinimize}" Stretch="None"/>
</Button>
<Button Width="35" Name="MaximazeButton" Style="{StaticResource CaptionButtonMinMax}">
<Image Source="{StaticResource pngMaximize}" Stretch="None"/>
</Button>
<Button Width="35" Name="CloseButton" Style="{StaticResource CaptionButtonClose}">
<Image Source="{StaticResource pngClose}" Stretch="None"/>
</Button>
</StackPanel>
</Grid>
</Grid>
</Window>
在设计器中我可以看到DropShadowEffect,但是当我运行应用程序时却不显示!
我不明白我在做什么错,所以有人可以帮助我纠正这个问题吗?