1
我是WPF的新手。当TextBlock
的IsEnabled
属性变为false
时,我试图将超链接的前景颜色更改为其他颜色(如灰色)。我应该添加一个Style
以达到我的要求吗?如何更改TextBlock的IsEnabled属性更改超链接的颜色?
我都卡在这里:
<TextBlock Margin="0,150,0,0"
TextAlignment="Center"
Background="White"
IsEnabled="{Binding ShowProgressRing}">
<Hyperlink x:Name="HyperLink"
Foreground="Blue"
TextDecorations="UnderLine"
FontSize="12"
FontWeight="SemiBold"
Command="{Binding Path=Command}" >
<Run Text="{Binding Path=HyperLinkText}"/>
</Hyperlink>
</TextBlock>
将Foreground属性绑定到IsEnabled属性并使用转换器来更改颜色。 –
@VishalPrajapati谢谢。我认为这会起作用 – ZigZig