Here is XAML for a window containing two buttons, both disabled. One of them has been made multiline by setting the button's content to a StackPanel containing two TextBlocks.

<Window x:Class="MainWindow"
        Title="MainWindow" Height="450" Width="800">
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        <Button Grid.Column="0" Content="Single line" IsEnabled="False" />
        <Button Grid.Column="1" IsEnabled="False">
                <TextBlock HorizontalAlignment="Center">Double</TextBlock>
                <TextBlock HorizontalAlignment="Center">Line</TextBlock>

Here is what it looks like on my machine when I run the program:

enter image description here

Why is the text on one button different to the other? On the single-line button the text is a more faded colour. I want the text to look the same on both buttons.


  • I want to do this purely in XAML.

  • The text must be centered within the button as shown (automatically by the framework, without me having to manually space it out by inserting nonbreaking spaces or the like). In particular, solutions that cause the left-hand edge of the "L" in "Line" to line up vertically with the left-hand edge of the "D" in "Double" are not acceptable. (So using the Content attribute in the second button but embedding a &#xa; in the text is not a viable solution, since it causes this effect.)

  • I don't want to have to paste a load of style information into my XAML. Solutions that involve pasting in a definition of what a disabled button looks like are not acceptable; I want both buttons to just look like whatever a disabled button should look like by default on my operating system, without having to explicitly specify what that means. Declarative solutions, that involve directing XAML to use whatever style would ordinarily be applied to text in a disabled button - these are fine, so long as I don't have to explicitly specify what that style looks like.


I installed the latest version of the .NET Framework Developer Pack and then restarted my machine. When the machine came back up, I could no longer reproduce the problem either in my example project or in the real project where I first saw the issue. I do not know whether the problem was fixed by updating the .NET Framework Developer Pack or by the restart.

Since I do not know what ultimately caused the issue or which action I took was the one that fixed it, I am not going to mark this as an accepted answer, but I offer it in case it proves helpful to anyone else. Perhaps someone is able to offer an explanation of the behaviour I originally saw.


This is a response so I can add a picture for you.

I just copied the XAML it works perfectly fine they look the same for me. You need to check if you have any styles defined anywhere that could cause this behaviour (It looks the same during runtime)

enter image description here


<Button Grid.Column="1" IsEnabled="False">
    <TextBlock HorizontalAlignment="Center">
  • The project containing the code I show in the question was created using the default WPF application template in Visual Studio. If there are any nonstandard styles being applied globally (I don't believe there are), then they are part of the template from VS. If you think this is the case, please let me know where I might look. – Hammerite Apr 11 at 14:36
  • restart your IDE sounds like a unicorn-problem to me. Please let me know if the restart fixed the issue as otherwhise my brain wont let me rest – Denis Schaf Apr 11 at 14:38
  • OK, I just closed all my open instances of Visual Studio and re-opened the test project, and as I expected, it behaves exactly the same as it did before. I think it's clear that you don't have any idea what causes this behaviour or how to fix it. However, from your inability to reproduce the behaviour I deduce that it it is likely specific to a certain version of the development tools, or of the runtime, or of the operating system. – Hammerite Apr 11 at 14:44
  • can you create a new empty project and see if the issue persists? if that is the case it is definitely a code independent problem – Denis Schaf Apr 11 at 14:46
  • I did. That is how I created the project I used as the basis for that screenshot. I don't have a use in my real project for a main window filled up with nothing but two disabled buttons. – Hammerite Apr 11 at 14:48

What you have (also) gives the expected result for me using vs2017 on win10.

You could alternatively get the same effect using one textblock:

    <Button Grid.Column="0" Content="Single line" IsEnabled="False" />
    <Button Grid.Column="1" IsEnabled="False">
        <TextBlock Style="{x:Null}" TextAlignment="Center">Double<LineBreak/>Line</TextBlock>

That markup also sets any styling to null on the textblock. Sounds like it won't help but I don't follow what's going on in your solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.