Share via


BackdropMaterial Class

Definition

Helper class to apply a backdrop material to the root of the XAML content.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

public ref class BackdropMaterial : DependencyObject
/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.XamlContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class BackdropMaterial : DependencyObject
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.XamlContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public class BackdropMaterial : DependencyObject
Public Class BackdropMaterial
Inherits DependencyObject
<Page muxc:BackdropMaterial.ApplyToRootOrPageBackground="True">
    pageContent
</Page>
-or-
<Frame muxc:BackdropMaterial.ApplyToRootOrPageBackground="True">
    appContent
</Frame>
Inheritance
BackdropMaterial
Attributes
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute ContractVersionAttribute MarshalingBehaviorAttribute ThreadingAttribute

Examples

Tip

For more info, design guidance, and code examples, see Mica.

The WinUI 3 Gallery and WinUI 2 Gallery apps include interactive examples of most WinUI 3 and WinUI 2 controls, features, and functionality.

If installed already, open them by clicking the following links: WinUI 3 Gallery or WinUI 2 Gallery.

If they are not installed, you can download the WinUI 3 Gallery and the WinUI 2 Gallery from the Microsoft Store.

You can also get the source code for both from GitHub (use the main branch for WinUI 3 and the winui2 branch for WinUI 2).

Remarks

A backdrop material is a Material created from a source of pixels taken from an area behind the XAML content.

The BackdropMaterial class lets you apply a backdrop material, Mica, to your application's composition target. It automatically supports theme changes, down-level versions, and device state, by setting a neutral-colored XAML brush when necessary.

Caution

When you apply the backdrop material, do not also set the Background property on the UI content. The background must be transparent so the backdrop material shows through.

XAML attached properties

BackdropMaterial is the host service class for the ApplyToRootOrPageBackground XAML attached property.

In order to support XAML processor access to the attached properties, and also to expose equivalent get and set operations to code, each XAML attached property has a pair of Get and Set accessor methods. Another way to get or set the value in code is to use the dependency property system, calling either GetValue or SetValue and passing the identifier field as the dependency property identifier.

Attached property Description
ApplyToRootOrPageBackground Applies the backdrop material to the root or background of the XAML content. The ApplyToRootOrPageBackground property is a Boolean value that indicates whether the backdrop material is applied.

Properties

ApplyToRootOrPageBackgroundProperty

Identifies the BackdropMaterial.ApplyToRootOrPageBackground XAML attached property.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

Attached Properties

ApplyToRootOrPageBackground

Applies the backdrop material to the root or background of the XAML content.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

Methods

GetApplyToRootOrPageBackground(Control)

Gets the value of the BackdropMaterial.ApplyToRootOrPageBackground XAML attached property for the target element.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

SetApplyToRootOrPageBackground(Control, Boolean)

Sets the value of the BackdropMaterial.ApplyToRootOrPageBackground XAML attached property for a target element.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

Applies to

See also