I want to cross out text in a WPF text block. how to do it?
Relations Raju
In C #:
textBox.Foreground = Brushes.Gray;
In XAML:
<TextBox Foreground="Gray" />
To disable it (the background will also change):
textBox.IsEnabled = false;
You can set the TextBlock.Foreground property for any color (technically, any brush). If you want it to be grayed out, just set:
<TextBlock Text="Foo" Foreground="Gray" />
If you want it to look βdisabledβ, you can set IsEnabled to false:
<TextBlock Text="Foo" IsEnabled="false" />
The IsEnabled flag for textblock does not execute gray text. This post details the differences between textblock and label. It also shows that XAML adds an IsEnabled trigger for gray text.
IsEnabled
textblock
The problem with using a TextBox is that there is a field around it. If you use Label (with Content = "Foo"), you can switch the color of the text using IsEnabled. Otherwise, it behaves like a TextBlock for a short title / label.
Use a TextBox instead and set IsReadOnly = true or IsEnabled = false
IsReadOnly = true
IsEnabled = false
Source: https://habr.com/ru/post/1313431/More articles:Android: how to listen to scrolling events? - androidhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1313427/is-there-a-perl-module-that-can-start-a-process-and-return-the-three-main-io-handles-to-that-process&usg=ALkJrhjWDrazrzdBX3u-7sO-dqvY7W3oyACheck javascript for text fields created dynamically - javascriptCan I install Visual Studio 2010 and 2008 together? - visual-studioHow to dynamically populate annotation - javaPlone and Python scripts - pythonWhat is the best way to use LINQ to SQL in a C # application? [Design Template] - c #PHP Best Forwarding Techniques - phpphp Curl error: Error receiving data from partner - phpUsing Grails Without a User Interface - grailsAll Articles