我有一个带有阴影效果的弹出窗口,并且在设计器视图中看起来不错,但是当我运行该应用程序时,弹出窗口周围有一个黑色矩形,我还为边框添加了一个边距,但这只是使矩形更大
<Popup PlacementTarget="{Binding ElementName=txtName}" Placement="Bottom" x:Name="AlertPopup">
<Border Margin="0,0,15,15" Background="#272C30" BorderBrush="#6C757D" BorderThickness="2" CornerRadius="10">
<Border.Effect>
<DropShadowEffect Color="Black" BlurRadius="25" Direction="315" ShadowDepth="15" Opacity="0.3"/>
</Border.Effect>
<TextBlock Padding="7" Foreground="#ADB5BD" Background="Transparent" FontSize="12"
Text="The file name can't contain any of the following characters:
\ / : * ? " > < |"/>
</Border>
</Popup>
这是我运行它时的样子:
答案 0 :(得分:2)
在您的AllowsTransparency="True"
上设置Popup
:
<Popup PlacementTarget="{Binding ElementName=txtName}" Placement="Bottom" x:Name="AlertPopup" IsOpen="true" AllowsTransparency="True">
<Border Margin="0,0,15,15" Background="#272C30" BorderBrush="#6C757D" BorderThickness="2" CornerRadius="10">
<Border.Effect>
<DropShadowEffect Color="Black" BlurRadius="25" Direction="315" ShadowDepth="15" Opacity="0.3"/>
</Border.Effect>
<TextBlock Padding="7" Foreground="#ADB5BD" Background="Transparent" FontSize="12"
Text="The file name can't contain any of the following characters:
\ / : * ? " > < |"/>
</Border>
</Popup>
运行时的外观如下: