TextElement.Background Property
.NET Framework 4.5
Gets or sets the Brush used to fill the background of the content area.
Assembly: PresentationFramework (in PresentationFramework.dll)
Property Value
Type: System.Windows.Media.BrushThe brush used to fill the background of the content area, or Nothing to not use a background brush. The default is Nothing.
The following example shows how to set the Background attribute, using Paragraph as the example element.
<FlowDocumentReader> <FlowDocument> <Paragraph Background="Bisque" Foreground="DarkGreen" Padding="4" > <Run> This text has a foreground color of dark green, and a background color of bisque. </Run> </Paragraph> </FlowDocument> </FlowDocumentReader>
The following figure shows how the preceding example renders.
.png?cs-save-lang=1&cs-lang=vb)
The following example shows how to set the Background property programmatically.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.