【发布时间】:2015-12-17 15:14:24
【问题描述】:
我想在启用按钮时将椭圆填充颜色更改为绿色。
<Button x:Name="btn_Kaart2" Grid.Column="1" Grid.Row="2" IsEnabled="False">
<Button.Template>
<ControlTemplate>
<Ellipse x:Name="ellipse_2"
Height="35"
Stroke="Black"
Fill="Red"
Margin="-300,440,0,0"/>
</ControlTemplate>
</Button.Template>
</Button>
通常我会使用ellipse_2.Fill = "Color",但这不起作用,程序找不到ellipse_2
【问题讨论】:
-
能否提供您尝试更改颜色的代码?
-
ellipse_2!=elliplse_2 -
@blas3nik 目前我只有一个带有 if 子句的方法,用于检查按钮是否启用,并且在加载 UserControl 时调用该方法。
-
@Albireo 抱歉,这只是一个错字。