TextElement.Background Propiedad

Definición

Obtiene o establece el pincel que se usa para rellenar el fondo del área de contenido.

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

Valor de propiedad

Brush

Pincel que se usa para rellenar el fondo del área de contenido o null para no utilizar ningún pincel de fondo. De manera predeterminada, es null.

Ejemplos

En el ejemplo siguiente se muestra cómo establecer el Background atributo utilizando Paragraph como elemento de ejemplo.

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

En la ilustración siguiente se muestra cómo se representa el ejemplo anterior.

Captura de pantalla: primer plano verde, fondo miel

En el ejemplo siguiente se muestra cómo establecer la Background propiedad mediante programación.

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

Comentarios

Para ver una tabla de muestras que muestran los colores predefinidos del pincel disponibles, vea Brushes.

Información sobre propiedades de dependencia

Campo identificador BackgroundProperty
Propiedades de metadatos establecidas en true AffectsRender

Se aplica a

Consulte también