Panel.Background Propiedad

Definición

Obtiene o establece un Brush objeto que se usa para rellenar el área entre los bordes de un Panelobjeto .

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

Un objeto Brush. Este valor predeterminado es null.

Ejemplos

En el ejemplo siguiente se establece el Background de en Grid .RadialGradientBrush

<Grid>
  <Grid.Background>
    <RadialGradientBrush 
        GradientOrigin="0.5,0.5" 
        Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">
      <RadialGradientBrush.GradientStops>
        <GradientStop Color="Yellow" Offset="0" />
        <GradientStop Color="Red" Offset="0.25" />
        <GradientStop Color="Blue" Offset="0.75" />
        <GradientStop Color="Green" Offset="1" />
      </RadialGradientBrush.GradientStops>
    </RadialGradientBrush>
  </Grid.Background>
</Grid>

Comentarios

Panellos elementos no reciben eventos de mouse o lápiz si no se define .Background Si necesita controlar eventos de mouse o lápiz, pero no desea un fondo para Panel, use Transparent.

Información de la propiedad dependency

Elemento Value
Campo identificador BackgroundProperty
Propiedades de metadatos establecidas en true AffectsRender, SubPropertiesDoNotAffectRender

Se aplica a

Consulte también