You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Revise SystemBackdropHost Spec for clarity and consistency
Updated the documentation for SystemBackdropHost to improve clarity and consistency. Adjusted wording for better readability and fixed minor grammatical issues.
Copy file name to clipboardExpand all lines: specs/SystemBackdropHost Spec.md
+67-45Lines changed: 67 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,56 +3,57 @@ SystemBackdropHost
3
3
4
4
# Background
5
5
6
-
System backdrop materials such as Mica, Acrylic, and future platform-provided surfaces are delivered through the
7
-
`Microsoft.UI.Xaml.Media.SystemBackdrop` API surface. When apps want to expose these surfaces inside specific areas in the UI (as opposed to applying them to the full window), they need a XAML element that can connect the backdrop to the
8
-
visual tree, manage its lifetime, and clip it to the intended layout bounds. Today, the only supported way to host a
9
-
system backdrop is at the window level, which makes it awkward to layer the effect behind individual sections of UI or
10
-
inside islands.
6
+
System backdrop materials such as Mica, Acrylic etc are delivered through
7
+
`Microsoft.UI.Xaml.Media.SystemBackdrop`. When you want to expose those materials inside a specific region of your UI
8
+
rather than across an entire window, you need an element that can connect the backdrop to the visual tree, manage its
9
+
lifetime, and clip it to the layout bounds. Today, you can only host a system backdrop at the window level, which makes
10
+
it awkward to layer the effect behind individual sections of content or inside islands. There is no public stable API available
11
+
in composition layer as well which allow apps to add backdrops in a specific area.
11
12
12
13
`SystemBackdropHost` is a lightweight `FrameworkElement` that bridges between the XAML tree and the composition
13
-
infrastructure required by `SystemBackdrop`. It automatically creates the composition link that a backdrop needs,
14
-
maintains the placement visual at the arranged size of the element, and translates the element's `CornerRadius` to the
15
-
backdrop clip so that rounded surfaces are respected as required.
14
+
infrastructure required by `SystemBackdrop`. It creates the composition link a backdrop needs, keeps the placement
15
+
visual sized to the arranged bounds, and applies the element's `CornerRadius` to the backdrop clip so rounded corners
16
+
appear as expected.
16
17
17
18
## Goals
18
19
19
-
* Provide an intuitive, XAML-friendly way to place a system backdrop anywhere inside an app's visual tree.
20
-
* Ensure the host handles connection, disconnection, and sizing so that apps only need to set a backdrop and place the
21
-
element.
22
-
* Allow apps to round the hosted backdrop without writing custom composition code.
20
+
* Provide an intuitive, XAML-friendly way to place a system backdrop anywhere inside application's visual tree.
21
+
* Handle connection, disconnection, and sizing so application only have to set a backdrop and position the element.
22
+
* Allow to round the hosted backdrop without writing custom composition code.
23
23
24
24
## Non-goals
25
25
26
-
*Replace the window-level backdrop APIs on `Window` or `AppWindow`.
26
+
*Supporting backdrop independently on all controls.
27
27
* Provide a content container; `SystemBackdropHost` is purely a visual effect surface and does not host child content.
28
28
29
+
# Conceptual pages (How To)
30
+
31
+
The guidance in the below examples can be followed by developers for adopting
32
+
`SystemBackdropHost`.
33
+
29
34
# API Pages
30
35
36
+
_(Each level-two section below maps to a docs.microsoft.com API page.)_
37
+
31
38
## SystemBackdropHost class
32
39
40
+
Use `SystemBackdropHost` to place a system-provided material anywhere within your XAML layout.
In both snippets, `rootGrid` represents the panel that hosts the backdrop surface just behind your content.
98
+
99
+
### Remarks
100
+
101
+
* _Spec note: This type is currently marked `[MUX_PREVIEW]`; the API surface may still change before it is finalized._
102
+
* The host creates a `ContentExternalBackdropLink` when it is loaded and a `SystemBackdrop` is assigned. When you
103
+
remove the backdrop or the element unloads, the host releases the composition resources.
104
+
* The element does not render visuals of its own. Place it behind other content (for example as the first child inside a
105
+
panel) to expose the backdrop surface.
106
+
* The host only connects to a backdrop while it has a `XamlRoot`. If the element is not in the live tree, the backdrop
107
+
remains disconnected until it is loaded again.
108
+
97
109
## SystemBackdropHost.SystemBackdrop property
98
110
99
-
Gets or sets the `SystemBackdrop` instance that should render within this host. The default value is `null`.
111
+
Gets or sets the `SystemBackdrop` instance that renders within this host. The default value is `null`.
100
112
101
-
* When set to a non-null systembackdrop and the host is loaded, the host invokes `SystemBackdrop.OnTargetConnected` with a `ContentExternalBackdropLink` that matches the arranged size of the element. The connection occurs lazily the next time the element is loaded if it is not already in the live tree.
102
-
* Changing the property disconnects the previously assigned backdrop (via `OnTargetDisconnected`) before connecting the new value. Setting the property back to `null` releases the composition resources and removes the child visual from the element.
103
-
* The property supports data binding and can be animated. Applications typically assign platform-provided backdrop types such as `MicaBackdrop`, `DesktopAcrylicBackdrop`, or custom subclasses of `SystemBackdrop`.
104
-
* If the element does not yet have a `XamlRoot`, the connection is postponed until one becomes available.
113
+
* When you assign a non-null backdrop and the host is loaded, it calls `SystemBackdrop.OnTargetConnected` with a
114
+
`ContentExternalBackdropLink` that matches the element's arranged size. If the host is not yet loaded, the connection
115
+
happens the next time it loads.
116
+
* Changing the property disconnects the previous backdrop (through `OnTargetDisconnected`) before connecting the new
117
+
value. Setting the property to `null` releases the composition resources and removes the child visual from the
118
+
element.
119
+
* You can data bind or animate this property. Typical values include `MicaBackdrop`, `DesktopAcrylicBackdrop`, or a
120
+
custom subclass of `SystemBackdrop`.
121
+
* If the host does not yet have a `XamlRoot`, the connection is postponed until one becomes available.
105
122
106
123
## SystemBackdropHost.CornerRadius property
107
124
108
-
Gets or sets the `CornerRadius` that should be applied to the hosted backdrop surface. The default value is
109
-
`CornerRadius(0)`.
125
+
Gets or sets the `CornerRadius` applied to the hosted backdrop surface. The default value is `CornerRadius(0)`.
110
126
111
-
* The host uses a `RectangleClip` applied to the backdrop's placement visual so that the rounded corner can be applied on all four edges.
112
-
* Setting the property while the element is loaded immediately updates the clip. Setting it to `null` (from markup or a binding) clears the corner radius and restores square corners.
113
-
* This property only affects the clip applied to the backdrop; it does not change layout or apply corner rounding to other child elements that may be layered on top.
127
+
* The host applies a `RectangleClip` on the placement visual to achieve the rounded corners.
128
+
* Updating the property while the element is loaded immediately refreshes the clip. Setting the property to `null` (for
129
+
example through a binding) clears the stored corner radius and restores square corners.
130
+
* This property only affects the backdrop clip. It does not change layout or round other content layered above the
0 commit comments