Search code examples
wpftextblock

WPF Text block gray out text


I want to gray out text in the WPF text block. how do i make it?

Regards Raju


Solution

  • On C#:

    textBox.Foreground = Brushes.Gray;
    

    On XAML:

    <TextBox Foreground="Gray" />
    

    To disable it (will change background too):

    textBox.IsEnabled = false;