TextElement.Background Tulajdonság

Definíció

Lekéri vagy beállítja a tartalomterület hátterének kitöltéséhez használt ecsetet.

public:
 property System::Windows::Media::Brush ^ Background { System::Windows::Media::Brush ^ get(); void set(System::Windows::Media::Brush ^ value); };
public System.Windows.Media.Brush Background { get; set; }
member this.Background : System.Windows.Media.Brush with get, set
Public Property Background As Brush

Tulajdonság értéke

A tartalomterület hátterének kitöltéséhez vagy null háttérkefe használatának hiányához használt ecset. Az alapértelmezett érték a null.

Példák

Az alábbi példa bemutatja, hogyan állíthatja be a Background attribútumot Paragraph mint példaelem használatával.

<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>

Az alábbi ábra bemutatja, hogyan jelenik meg az előző példa.

Képernyőkép: A zöld előtere, a háttér bisque

Az alábbi példa bemutatja, hogyan állíthatja be a Background tulajdonságot programozott módon.

Run run = new Run(
    "This text has a foreground color of dark green, and a background color of bisque.");
Paragraph par = new Paragraph(run);

par.Background = Brushes.Bisque;
par.Foreground = Brushes.DarkGreen;
Dim run As New Run("This text has a foreground color of dark green, and a background color of bisque.")
Dim par As New Paragraph(run)

par.Background = Brushes.Bisque
par.Foreground = Brushes.DarkGreen

Megjegyzések

A rendelkezésre álló előre definiált ecsetszíneket megjelenítő színtártáblákért lásd: Brushes.

Függőségi tulajdonság adatai

Termék Érték
Azonosító mező BackgroundProperty
Metaadat-tulajdonságok beállítása: true AffectsRender

A következőre érvényes:

Lásd még