Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF multiline button disabling

I have a button with multiline-text:

<Button x:Name="Start" IsEnabled="False">
  <TextBlock TextWrapping="Wrap">Some Text</TextBlock>
</Button>

If IsEnabled is False, then the button is disabled but the text inside the button is still black.

How can I set the button-text to a "disabled-style" - color?

like image 268
hugo Avatar asked Dec 31 '25 01:12

hugo


1 Answers

It seems that if you wrap your TextBlock in a Label, it will honor the IsEnabled style changes:

<Button x:Name="Start" IsEnabled="False">
    <Label>
        <Label.Content>
            <TextBlock Text="Some Text" TextWrapping="Wrap"/>
        </Label.Content>
    </Label>
</Button>
like image 161
Chris Avatar answered Jan 01 '26 17:01

Chris