Skip to content

Commit 8466d75

Browse files
committed
pass 3
1 parent 9a99898 commit 8466d75

6 files changed

+36
-36
lines changed

specs/DateTimePicker-Visual-Updates-Spec.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ This allows the element to appear to be an overlay on top of the other element.
1010

1111
`MonochromaticOverlayPresenter` element is similar to several precedents:
1212

13-
* [CompositionMaskBrush](https://learn.microsoft.com/uwp/api/Windows.UI.Composition.CompositionMaskBrush),
13+
- [CompositionMaskBrush](https://learn.microsoft.com/uwp/api/Windows.UI.Composition.CompositionMaskBrush),
1414
which is a brush that gets its content from another (source) brush.
15-
* WPF's [VisualBrush](https://learn.microsoft.com/dotnet/api/System.Windows.Media.VisualBrush),
15+
- WPF's [VisualBrush](https://learn.microsoft.com/dotnet/api/System.Windows.Media.VisualBrush),
1616
which uses an element's rendering to draw a brush.
1717

1818
A key difference in this new type is that it only renders the portion of the source
@@ -70,12 +70,12 @@ The following example puts a `MonochromaticOverlayPresenter` on top of (z-ordere
7070
some scrolling text, causing the center of the text to be highlighted, even as it's scrolling.
7171
Things to note:
7272

73-
* The `MonochromaticOverlayPresenter` is sourcing from the `TextBlock`, it's also z-ordered above
73+
- The `MonochromaticOverlayPresenter` is sourcing from the `TextBlock`, it's also z-ordered above
7474
the same `TextBlock`. If the `Background` and `SourceElement` properties weren't set,
7575
it would have no effect; it would render the `TextBlock` exactly on top of itself.
76-
* The `MonochromaticOverlayPresenter` is positioned and given a height such that it's a black band
76+
- The `MonochromaticOverlayPresenter` is positioned and given a height such that it's a black band
7777
across the center of the scrolling text.
78-
* The `MonochromaticOverlayPresenter.IsHitTestVisible` property is set to False, so that input
78+
- The `MonochromaticOverlayPresenter.IsHitTestVisible` property is set to False, so that input
7979
still goes to the ScrollViewer that is z-ordered behind it.
8080

8181
```xml

specs/Popup-AdditionalLayoutProperties-Spec.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ and
88
[flyouts](https://learn.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.Primitives.FlyoutBase)
99
in XAML are given two modes of display:
1010

11-
* They can either appear as part of the rest of XAML,
11+
- They can either appear as part of the rest of XAML,
1212
in which case they're confined to the bounds of the XAML root,
13-
* Or they can appear in their own HWND, which
13+
- Or they can appear in their own HWND, which
1414
allows them to escape the bounds of the XAML root. This is common for elements such as context menus.
1515

1616
[CommandBarFlyout](https://learn.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.CommandBarFlyout)

specs/SystemBackdropElement_Spec.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ SystemBackdropElement
44
# Background
55

66
There are backdrop materials provided in WinUI such as Mica, Acrylic that are subclass of
7-
[Microsoft.UI.Xaml.Media.SystemBackdrop](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.systembackdrop). Currently, it is possible to add a system backdrop only at the window level or on flyouts, but not in a specific area in the visual tree. This has been a major limitation on WinUI 3 compared to WinUI2 in achieving the acrylic / mica effects, especially for achieving various animations.
7+
[Microsoft.UI.Xaml.Media.SystemBackdrop](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.systembackdrop). Currently, it is possible to add a system backdrop only at the window level or on flyouts, but not in a specific area in the visual tree. This has been a major limitation on WinUI 3 compared to WinUI 2 in achieving the acrylic / mica effects, especially for achieving various animations.
88

99
`SystemBackdropElement` is a lightweight `FrameworkElement` that bridges between the XAML tree and the composition
1010
infrastructure required by `SystemBackdrop`. It creates the required composition components to add the systembackdrop on a specific area, resizes the systembackdrop to fill the given area, and applies the clip on the backdrop visual based on `CornerRadius` values applied on `SystemBackdropElement` which helps for rounded corners to
1111
appear as expected. This control abstracts lot of details for the composition layer and hence make it easy
1212
for WinUI 3 developers to implement the acrylic effect in the applications.
1313

14-
In WinUI2, it was possible to achieve the backdrop using `BackgroundSource` property of [AcrylicBrush](https://learn.microsoft.com/uwp/api/windows.ui.xaml.media.acrylicbrush?view=winrt-26100), However in WinUI 3, [AcrylicBrush](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.acrylicbrush) doesn't provide `BackgroundSource` property leaving it capable of achieving only in-app acrylic. This is due to the limitation of WinUI 3 compositor which is running in-proc, and so can't fetch buffers outside the application window. In this design, the solution is to leverage the [ContentExternalBackdropLink](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.content.contentexternalbackdroplink) API. It provides `PlacementVisual` that would be used for rendering the backdrop in the WinUI 3 visual tree. `SystemBackdropElement` control takes care of resizing and positioning this `PlacementVisual` as per the position, size and Z-order of the control.
14+
In WinUI 2, it was possible to achieve the backdrop using `BackgroundSource` property of [AcrylicBrush](https://learn.microsoft.com/uwp/api/windows.ui.xaml.media.acrylicbrush?view=winrt-26100), However in WinUI 3, [AcrylicBrush](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.acrylicbrush) doesn't provide `BackgroundSource` property leaving it capable of achieving only in-app acrylic. This is due to the limitation of WinUI 3 compositor which is running in-proc, and so can't fetch buffers outside the application window. In this design, the solution is to leverage the [ContentExternalBackdropLink](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.content.contentexternalbackdroplink) API. It provides `PlacementVisual` that would be used for rendering the backdrop in the WinUI 3 visual tree. `SystemBackdropElement` control takes care of resizing and positioning this `PlacementVisual` as per the position, size and Z-order of the control.
1515

1616
## Goals
1717

18-
* Provide an intuitive, XAML-friendly way to place a system backdrop anywhere inside application's visual tree.
19-
* Handle connection, disconnection, and sizing so application only have to set a backdrop and position the element.
20-
* Allow to put rounded corners on the backdrop without writing custom composition code.
18+
- Provide an intuitive, XAML-friendly way to place a system backdrop anywhere inside application's visual tree.
19+
- Handle connection, disconnection, and sizing so application only have to set a backdrop and position the element.
20+
- Allow to put rounded corners on the backdrop without writing custom composition code.
2121

2222
## Non-goals
2323

24-
* Adding a SystemBackdrop property independently on all controls.
25-
* Provide a content container; `SystemBackdropElement` is purely a visual effect surface and is not a container.
24+
- Adding a SystemBackdrop property independently on all controls.
25+
- Provide a content container; `SystemBackdropElement` is purely a visual effect surface and is not a container.
2626

2727
# Conceptual pages (How To)
2828

@@ -76,7 +76,7 @@ Keep the `SystemBackdropElement` in the bottom of the stack below other contents
7676

7777
The same pattern works from code:
7878

79-
* C#:
79+
- C#:
8080

8181
```csharp
8282
var backdropElement = new SystemBackdropElement
@@ -87,7 +87,7 @@ var backdropElement = new SystemBackdropElement
8787
rootGrid.Children.Add(backdropElement);
8888
```
8989

90-
* C++:
90+
- C++:
9191

9292
```cpp
9393
winrt::Microsoft::UI::Xaml::Controls::SystemBackdropElement backdropElement;
@@ -101,27 +101,27 @@ If a `CornerRadius` is applied on the parent `rootGrid`, that would clip the `Sy
101101
102102
### Remarks
103103
104-
* _Spec note: This API is currently `experimental`; the API surface may still change before it is finalized._
105-
* It is recommended to be used as first element for background effect to work appropriately, for example as the first child inside a
104+
- _Spec note: This API is currently `experimental`; the API surface may still change before it is finalized._
105+
- It is recommended to be used as first element for background effect to work appropriately, for example as the first child inside a
106106
panel. (First element added to tree gets rendered first and goes in the bottom of stack)
107-
* The `SystemBackdropElement` only connects to a backdrop while it has a `XamlRoot`. If the element is not in the live tree, the backdrop
107+
- The `SystemBackdropElement` only connects to a backdrop while it has a `XamlRoot`. If the element is not in the live tree, the backdrop
108108
remains disconnected until it is loaded.
109-
* As `SystemBackdropElement` control punches a hole in the layout to show the SystemBackdrop, properties like Shadow, Lights, Clip & Transform may not behave as intended.
109+
- As `SystemBackdropElement` control punches a hole in the layout to show the SystemBackdrop, properties like Shadow, Lights, Clip & Transform may not behave as intended.
110110
111111
## SystemBackdropElement.SystemBackdrop property
112112
113113
Gets or sets the `SystemBackdrop` instance that renders in the `SystemBackdropElement` area. The default value is `null`.
114114
115-
* You can data bind this property. Typical values include `MicaBackdrop`, `DesktopAcrylicBackdrop`, or a
115+
- You can data bind this property. Typical values include `MicaBackdrop`, `DesktopAcrylicBackdrop`, or a
116116
custom subclass of `SystemBackdrop`.
117-
* If the `SystemBackdropElement` does not yet have a `XamlRoot`, the connection is postponed until one becomes available.
117+
- If the `SystemBackdropElement` does not yet have a `XamlRoot`, the connection is postponed until one becomes available.
118118
119119
## SystemBackdropElement.CornerRadius property
120120
121121
Gets or sets the `CornerRadius` applied to the backdrop surface. The default value of `CornerRadius` is 0.
122122
123-
* The `SystemBackdropElement` applies a `RectangleClip` on the composition visual of SystemBackdrop to achieve the rounded corners.
124-
* Default `CornerRadius` value will be 0 aligning with [control templates](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.control.cornerradius#remarks) behavior.
123+
- The `SystemBackdropElement` applies a `RectangleClip` on the composition visual of SystemBackdrop to achieve the rounded corners.
124+
- Default `CornerRadius` value will be 0 aligning with [control templates](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.control.cornerradius#remarks) behavior.
125125
126126
# API Details
127127

specs/appwindow-spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ expose AppWindow object directly to app developer through an API. Instead of wri
1919
code everywhere, app developer can use this API, reducing code bloat, and making AppWindow APIs easily
2020
accessible from WinUI 3 code.
2121

22-
These *before* and *after* C# code examples illustrate how this API simplifies integrating AppWindow APIs in WinUI 3 codebase.
22+
These _before_ and _after_ C# code examples illustrate how this API simplifies integrating AppWindow APIs in WinUI 3 codebase.
2323

2424
- Before
2525

specs/xaml-backdrop-api.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Use this class to set a backdrop on a
8080
[Popup](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/Microsoft.UI.Xaml.Controls.Primitives.Popup)\*,
8181
or [FlyoutBase](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/Microsoft.UI.Xaml.Controls.Primitives.FlyoutBase)\* (such as a `Flyout` or `MenuFlyout`).
8282

83-
* `Popup`/`MenuFlyout` `SystemBackdrop` support is not available in WinAppSDK 1.3.0, but is expected to light up in a subsequent release. Note also `SystemBackdrop` will only work in "windowed" popups, i.e. those with _ShouldConstrainToRootBounds=False_.
83+
- `Popup`/`MenuFlyout` `SystemBackdrop` support is not available in WinAppSDK 1.3.0, but is expected to light up in a subsequent release. Note also `SystemBackdrop` will only work in "windowed" popups, i.e. those with _ShouldConstrainToRootBounds=False_.
8484

8585
For example:
8686

@@ -103,8 +103,8 @@ You don't create this class directly, but subclass it to add your custom support
103103

104104
Generally, the custom material overrides `OnTargetConnected` to create and configure a backing [ISystemBackdropController](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.isystembackdropcontroller?view=windows-app-sdk-1.3), which will manage the [CompositionBrush](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.compositionbrush?view=windows-app-sdk-1.3) used to fill the backdrop region. The brush's ultimate pixel rendering is affected by the environment/policy (set via [SystemBackdropConfiguration](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.systembackdropconfiguration?view=windows-app-sdk-1.3)) and material's appearance parameters, exposed via general (eg `ICompositionControllerWithTargets.SystemBackdropState` ∈ { _`Active` / `Fallback` / `HighContast`_ }) and material-specfic (eg `MicaController.Kind` ∈ { _`Base` / `BaseAlt`_} _SystemBackdropController_ properties.
105105

106-
* The controllers available today (`MicaController` and `DesktopAcrylicController`) support the following parameters for customizing their appearance: [FallbackColor](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.desktopacryliccontroller.fallbackcolor?view=windows-app-sdk-1.3), [LuminosityOpacity](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.desktopacryliccontroller.luminosityopacity?view=windows-app-sdk-1.3), [TintColor](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.micacontroller.tintcolor?view=windows-app-sdk-1.3), and [TintOpacity](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.micacontroller.tintopacity?view=windows-app-sdk-1.3).
107-
* The provided XAML backdrop materials `MicaBackdrop` and `DesktopAcrylicBackdrop` currently do not expose `FallbackColor` or the material customization properties (`TintOpacity`, etc), instead relying on the default Light/Dark configurations of the underlying `MicaController` and `DesktopAcrylicController`. To customize these properties, createa a custom material class deriving from SystemBackdrop that exposes the desired properties.
106+
- The controllers available today (`MicaController` and `DesktopAcrylicController`) support the following parameters for customizing their appearance: [FallbackColor](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.desktopacryliccontroller.fallbackcolor?view=windows-app-sdk-1.3), [LuminosityOpacity](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.desktopacryliccontroller.luminosityopacity?view=windows-app-sdk-1.3), [TintColor](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.micacontroller.tintcolor?view=windows-app-sdk-1.3), and [TintOpacity](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.micacontroller.tintopacity?view=windows-app-sdk-1.3).
107+
- The provided XAML backdrop materials `MicaBackdrop` and `DesktopAcrylicBackdrop` currently do not expose `FallbackColor` or the material customization properties (`TintOpacity`, etc), instead relying on the default Light/Dark configurations of the underlying `MicaController` and `DesktopAcrylicController`. To customize these properties, createa a custom material class deriving from SystemBackdrop that exposes the desired properties.
108108

109109
The following example shows a simple custom system backdrop class that's implemented using
110110
[MicaController](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/Microsoft.UI.Composition.SystemBackdrops.MicaController).
@@ -166,18 +166,18 @@ object that is set and maintained automatically for each `SystemBackdrop` usage
166166

167167
The properties on `SystemBackdropConfiguration` you receive may change over time:
168168

169-
* `Theme`: set based on [ElementTheme](https://learn.microsoft.com/uwp/api/Windows.UI.Xaml.ElementTheme) of the target element (obtained from xamlRoot.Content)
170-
* If `FallbackColor`, `LuminosityOpacity`, `TintColor`, or `TintOpacity` are modified by the material's implementation, changes to associated [SystemBackdropConfiguration.Theme](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.systembackdropconfiguration.theme?view=windows-app-sdk-1.3) will no longer automatically toggle the controller's theme (since default Dark and Light configurations are no longer appropriate). In this case, the material's appearance properties need to be manually updated to match the new Theme in `SystemBackdrop.OnDefaultSystemBackdropConfigurationChanged`.
169+
- `Theme`: set based on [ElementTheme](https://learn.microsoft.com/uwp/api/Windows.UI.Xaml.ElementTheme) of the target element (obtained from xamlRoot.Content)
170+
- If `FallbackColor`, `LuminosityOpacity`, `TintColor`, or `TintOpacity` are modified by the material's implementation, changes to associated [SystemBackdropConfiguration.Theme](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.systembackdropconfiguration.theme?view=windows-app-sdk-1.3) will no longer automatically toggle the controller's theme (since default Dark and Light configurations are no longer appropriate). In this case, the material's appearance properties need to be manually updated to match the new Theme in `SystemBackdrop.OnDefaultSystemBackdropConfigurationChanged`.
171171

172-
* `IsInputActive`: true if the target of the `SystemBackdrop` is in the active window.
172+
- `IsInputActive`: true if the target of the `SystemBackdrop` is in the active window.
173173

174-
* `IsHighContrast`: true if the target of the `SystemBackdrop` is in high contrast mode.
174+
- `IsHighContrast`: true if the target of the `SystemBackdrop` is in high contrast mode.
175175

176176
## SystemBackdrop.OnDefaultSystemBackdropConfigurationChanged virtual protected method
177177

178178
Override this method to be called when one of the properties (described above) on the object returned by `GetDefaultSystemBackdropConfiguration` has changed.
179179

180-
* This is useful when implementing a custom `SystemBackdropConfiguration` that incorporates some of the tracked property states but is different in some way from the default policy. First, obtain a `SystemBackdropConfiguration` object from `GetDefaultSystemBackdropConfiguration` as usual, but do not apply it via `CompositionController.SetSystemBackdropConfiguration`. Instead create an additional `SystemBackdropConfiguration` object that is updated on `OnDefaultSystemBackdropConfigurationChanged` by applying custom logic to the tracked property (eg ignoring Theme change). The second `SystemBackdropConfiguration` object is hooked up to `CompositionController.SetSystemBackdropConfiguration`, applying the custom policy.
180+
- This is useful when implementing a custom `SystemBackdropConfiguration` that incorporates some of the tracked property states but is different in some way from the default policy. First, obtain a `SystemBackdropConfiguration` object from `GetDefaultSystemBackdropConfiguration` as usual, but do not apply it via `CompositionController.SetSystemBackdropConfiguration`. Instead create an additional `SystemBackdropConfiguration` object that is updated on `OnDefaultSystemBackdropConfigurationChanged` by applying custom logic to the tracked property (eg ignoring Theme change). The second `SystemBackdropConfiguration` object is hooked up to `CompositionController.SetSystemBackdropConfiguration`, applying the custom policy.
181181

182182
## Other `SystemBackdrop` members
183183

0 commit comments

Comments
 (0)