在我的 XAML 中,我有:
<Canvas Grid.Row="1" Background="#FFF2F2F2" Width="78" HorizontalAlignment="Left">
<Rectangle Height="67" x:Name="rectFront" Width="70" Fill="#FF000000" Stroke="#FFB9B9B9" StrokeThickness="3" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" Stretch="Uniform" Canvas.Left="4"/>
</Canvas>
在 CS 代码中:
someColor = rectFront.Fill; // <-- error here, can't convert Brush to Color
这完全有道理。但是我怎样才能将画笔中的颜色属性从填充中转换出来呢?
谢谢
简单代码