Partager via


ChildWindow.OverlayBrush Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the visual brush that is used to cover the parent window when the child window is open.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls (in System.Windows.Controls.dll)

Syntax

'Declaration
Public Property OverlayBrush As Brush
public Brush OverlayBrush { get; set; }
<sdk:ChildWindow OverlayBrush="brushReference"/>

XAML Values

Property Value

Type: System.Windows.Media.Brush
The visual brush that is used to cover the parent window when the ChildWindow is open. The default is nulla null reference (Nothing in Visual Basic).

Remarks

Dependency property identifier field: OverlayBrushProperty

The overlay is the part of the ChildWindow that covers the parent window.

Examples

The following example demonstrates how to set the OverlayBrush in XAML and code. This example is part of a larger example available in the ChildWindow class overview.

Run this sample

The example brush named overlayGradient is a RadialGradientBrush defined as a XAML resource in the App.xaml file:

<Application.Resources>
    <!-- Gradient for ChildWindow overlay. -->
    <RadialGradientBrush x:Key="overlayGradient">
        <GradientStop Color="#FFA3A7B9" Offset="0"/>
        <GradientStop Color="#FF3F3E4B" Offset="1"/>
        <GradientStop Color="#FF7B98C1" Offset="0.457"/>
    </RadialGradientBrush>
</Application.Resources>

The following shows how to set the OverlayBrush in XAML:

<!-- NOTE: 
  By convention, the sdk prefix indicates a URI-based XAML namespace declaration 
  for Silverlight SDK client libraries. This namespace declaration is valid for 
  Silverlight 4 only. In Silverlight 3, you must use individual XAML namespace 
  declarations for each CLR assembly and namespace combination outside the scope 
  of the default Silverlight XAML namespace. For more information, see the help 
  topic "Prefixes and Mappings for Silverlight Libraries". 
-->
<sdk:ChildWindow x:Class="ChildWindowSplash.SplashWindow"
           xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:sdk="https://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           Width="200" Height="150"
           HasCloseButton="False"
           OverlayBrush="{StaticResource overlayGradient}"
           OverlayOpacity="0.85">

The following shows how to set the OverlayBrush in code:

Me.OverlayBrush = App.Current.Resources("overlayGradient")
this.OverlayBrush = (RadialGradientBrush)App.Current.Resources["overlayGradient"];

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.