我有问题,访问画布中的路径,我希望能够更改我的代码中的'填充'(c#)。 这些是我的xaml代码:
<Canvas Name="hour" Opacity="0.05" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="0" Height="0" >
<Path Fill="Aquamarine">
<Path.Data>
<EllipseGeometry RadiusX="50" RadiusY="50"/>
</Path.Data>
</Path>
</Canvas>
如何获得它?
答案 0 :(得分:1)
请给它起个名字:
<Path x:Name="myPath" Fill="Aquamarine">
因此,您可以在代码中访问它,例如:
myPath.Fill = new SolidColorBrush(Colors.Blue);