我正在将应用程序从WPF移植到UWP。 直到现在,我已经使用下面的代码来绘制一个虚线的边框。绘制虚线边框
<Border.BorderBrush>
<VisualBrush>
<VisualBrush.Visual>
<Rectangle StrokeDashArray="1.0 1.0"
Stroke="{StaticResource ListBorderColor}"
StrokeThickness="2"
RadiusX="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=CornerRadius.TopRight}"
RadiusY="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=CornerRadius.BottomLeft}"
Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}"/>
</VisualBrush.Visual>
</VisualBrush>
</Border.BorderBrush>
不幸的是,这段代码在UWP中不再有效。 我曾尝试下面的代码,但结果不是从视觉角度
<Border.BorderBrush>
<LinearGradientBrush StartPoint="0,0" EndPoint="2,0"
SpreadMethod="Repeat" MappingMode="Absolute">
<GradientStop Color="Transparent" Offset="0" />
<GradientStop Color="Transparent" Offset="0.499" />
<GradientStop Color="#999" Offset="0.5" />
</LinearGradientBrush>
</Border.BorderBrush>
有没有人有一个想法如何实现UWP均匀虚线圆角的边框一样的吗?
真的很巧妙和简单的方法 –