Поделиться через


ChildWindow.OverlayOpacity Property

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

Gets or sets the opacity of the overlay 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 OverlayOpacity As Double
public double OverlayOpacity { get; set; }
<sdk:ChildWindow OverlayOpacity="double"/>

Property Value

Type: System.Double
The opacity of the overlay brush that is used to cover the parent window when the ChildWindow is open. The default is 1.0.

Remarks

Dependency property identifier field: OverlayOpacityProperty

OverlayOpacity determines how much the parent window shows through the overlay area. A value of 0.0 is completely transparent; a value of 1.0 is completely opaque. An OverlayBrush might have its own opacity setting that will affect the overall opacity of the overlay area. For example, the parent window will show through a semi-transparent OverlayBrush even if the OverlayOpacity is set to 1.0.

Examples

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

Run this sample

The following shows how to set the OverlayOpacity 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 OverlayOpacity in code:

Me.OverlayOpacity = 0.85
this.OverlayOpacity = 0.85;

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.