Partager via


FlowDocument.Background Propriété

Définition

Obtient ou définit l’élément Brush utilisé pour remplir l’arrière-plan de la zone de contenu.

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

Valeur de propriété

Pinceau utilisé pour remplir l’arrière-plan de la zone de contenu ou null pour ne pas utiliser un pinceau d’arrière-plan. La valeur par défaut est null.

Exemples

L’exemple suivant montre comment définir l’attribut Background d’un FlowDocument élément.

<FlowDocumentReader>
  <FlowDocument 
    Background="IndianRed"
    Foreground="NavajoWhite"
  >
    <Paragraph>
      This FlowDocument will have a background color of Indian red, with the text
      colored Navajo white.  Any Forground or Background settings on this paragraph
      would override the top-level settings for the FlowDocument.
    </Paragraph>
  </FlowDocument>
</FlowDocumentReader>

L’exemple suivant montre comment définir la Background propriété par programmation.

FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("A bit of text content...")));
flowDoc.Background = Brushes.IndianRed;
flowDoc.Foreground = Brushes.NavajoWhite;
Dim flowDoc As New FlowDocument(New Paragraph(New Run("A bit of text content...")))
flowDoc.Background = Brushes.IndianRed
flowDoc.Foreground = Brushes.NavajoWhite

Remarques

Pour obtenir une table de nuances qui affiche les couleurs de pinceau prédéfinies disponibles, consultez Brushes.

Informations sur les propriétés de dépendance

Élément Valeur
Champ d’identificateur BackgroundProperty
Propriétés de métadonnées définies sur true AffectsRender

S’applique à