Я пытаюсь определить Style
, которые могут быть использованы, где Button
держит TextBlock
как его Content
и когда Button
имеет IsEnabled
= False Я хочу установить TextBlock
«s Foregroung
цвет.Binding TextBlock цвет кнопки IsEnabled от стиля
<Button Style="{StaticResource TransparentButtonStyle}"
IsEnabled="{Binding IsAllowed}">
<TextBlock Text="Click Me"
Style="{StaticResource HyperLinkStyle}">
</TextBlock>
</Button>
<Style x:Key="TransparentButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="Transparent">
<ContentPresenter/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="HyperLinkStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="Blue" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Foreground" Value="LightBlue" />
<Setter Property="TextDecorations" Value="Underline" />
</Trigger>
</Style.Triggers>
</Style>
Могу ли я модифицировать TextBlock
«s Style
, чтобы захватить родительский Button
» IsEnabled
значение s каким-то образом, чтобы иметь возможность установить Foreground
цвет?