Demand background
When the program we write is released, the user is doing some dangerous operations. Our software should give some reminder effects, such as red on the edge of the border, similar to the alarm reminder effect like Gaode Map

implementing logical
To prepare the border element Border, we set its border line, line color and Effect effect. The Effect effect is set to DropShadowEffect. The more important ones are the BlurRadius and Color attributes in DropShadowEffect.
difficulties
If the border line color is transparent, it will not take effect if DropShadowEffect is set
solutions
We set any color for the border line color, preferably a solid color, and then we use the ClipToBounds property of the Grid to crop out the extra colors of the Border. At this time, you will see that the border line of the Border is very thick, which is not an ideal effect. At this time, we can think backwards and set the Border's Margin to a negative number. For example, BorderThickness is 10, then Margin is set to-10. At this time, we can see the effect we want.

<Grid CacheMode="BitmapCache" ClipToBounds="True">
<Border Margin="-10"
BorderBrush="#FFFF"
BorderThickness="10"
CacheMode="BitmapCache">
<Border.Effect>
<DropShadowEffect
BlurRadius="40"
Direction="275"
RenderingBias="Performance"
ShadowDepth="0"
Color="Red" />
</Border.Effect>
</Border>
<Border
Margin="-10"
BorderBrush="#FFFF"
BorderThickness="10"
CacheMode="BitmapCache">
<Border.Effect>
<DropShadowEffect
BlurRadius="40"
Direction="275"
RenderingBias="Performance"
ShadowDepth="0"
Color="Red" />
</Border.Effect>
</Border>
</Grid>
If the color is too light, we can just add a few more overlaps
** Reminder: You must carefully read and understand the article before using it. Try not to copy and paste it. It is better to teach people to fish than teach people to fish. Please be patient to understand and read it!! **
The webmaster implemented the Avalonia version according to the original author's code, and the effect is as follows:

The code is as follows:
<u:UrsaWindow xmlns="https://github.com/avaloniaui"
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:u="https://irihi.tech/ursa"
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="450"
Width="400" Height="450"
x:Class="DeviceMrgSample.Views.WarningWindow"
Title="WarningWindow">
<u:UrsaWindow.Styles>
<Style Selector="Border.warning-border">
<Style.Animations>
<Animation Duration="0:0:05"
IterationCount="Infinite"
PlaybackDirection="Alternate">
<KeyFrame Cue="0%">
<Setter Property="Opacity" Value="0.5"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Opacity" Value="1"/>
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
<Style Selector="Grid#gridRoot > TranslateTransform">
<Style.Animations>
<Animation Duration="0:0:0.3"
IterationCount="Infinite">
<KeyFrame Cue="0%">
<Setter Property="X" Value="0"/>
<Setter Property="Y" Value="0"/>
</KeyFrame>
<KeyFrame Cue="20%">
<Setter Property="X" Value="-10"/>
<Setter Property="Y" Value="5"/>
</KeyFrame>
<KeyFrame Cue="40%">
<Setter Property="X" Value="8"/>
<Setter Property="Y" Value="-7"/>
</KeyFrame>
<KeyFrame Cue="60%">
<Setter Property="X" Value="-12"/>
<Setter Property="Y" Value="3"/>
</KeyFrame>
<KeyFrame Cue="80%">
<Setter Property="X" Value="9"/>
<Setter Property="Y" Value="-4"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="X" Value="0"/>
<Setter Property="Y" Value="0"/>
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
</u:UrsaWindow.Styles>
<Grid x:Name="gridRoot" ClipToBounds="True">
<Grid.RenderTransform>
<TranslateTransform/>
</Grid.RenderTransform>
<Border Classes="warning-border"
Margin="-25"
BorderBrush="#FFFF"
BorderThickness="25">
<Border.Effect>
<DropShadowEffect
BlurRadius="40"
OffsetX="0"
OffsetY="0"
Opacity="0.8"
Color="Red" />
</Border.Effect>
</Border>
<Border
Margin="-15"
BorderBrush="#FFFF"
BorderThickness="15">
<Border.Effect>
<DropShadowEffect
BlurRadius="40"
OffsetX="0"
OffsetY="0"
Color="Red" />
</Border.Effect>
</Border>
<StackPanel VerticalAlignment="Center"
HorizontalAlignment="Center"
Margin="40">
<TextBlock Text="❗ 磁盘告警 ❗"
FontSize="36"
FontWeight="Black"
Foreground="#FFFF00"
Margin="0 0 0 30"
TextAlignment="Center">
<TextBlock.Effect>
<DropShadowEffect Color="#CC0000"
BlurRadius="12"
OffsetX="2"
OffsetY="2"/>
</TextBlock.Effect>
</TextBlock>
<TextBlock Text="D盘剩余空间不足2GB(20%)"
FontSize="26"
FontWeight="Bold"
Foreground="#FFEB3B"
TextWrapping="Wrap"
MaxWidth="280"
Margin="0 0 0 20"
TextAlignment="Center">
<TextBlock.Effect>
<DropShadowEffect Color="#B71C1C"
BlurRadius="8"
OffsetX="1"
OffsetY="1"/>
</TextBlock.Effect>
</TextBlock>
<TextBlock Text="请立即清理,避免系统崩溃!"
FontSize="24"
FontWeight="SemiBold"
Foreground="#FFEE58"
TextAlignment="Center"
Margin="0 10 0 0">
<TextBlock.Effect>
<DropShadowEffect Color="#C62828"
BlurRadius="6"
OffsetX="1"
OffsetY="1"/>
</TextBlock.Effect>
</TextBlock>
</StackPanel>
</Grid>
</u:UrsaWindow>