移动虚线以进行裁剪

Rya*_*tes 2 c# wpf marching-ants

我知道我可以使用以下代码创建虚线.

<Window x:Class="MarchingAnts.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Rectangle x:Name="RubberBand" Stroke="Black" StrokeDashArray="10"></Rectangle>
    </Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)

有没有办法让虚线围绕该区域移动以引起对它的注意?

这是用于裁剪图像,因此很容易区分裁剪线.

Fed*_*gui 5

<Storyboard x:Key="BorderAnimation">
    <DoubleAnimation To="200" Duration="0:0:10" RepeatBehavior="Forever" By="2" 
                     Storyboard.TargetProperty="StrokeDashOffset" Storyboard.TargetName="Border"/>
</Storyboard>
Run Code Online (Sandbox Code Playgroud)