Skip to content

Commit ac754eb

Browse files
committed
shorten headings
1 parent 029dc8a commit ac754eb

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

hub/apps/develop/composition/using-the-visual-layer-with-xaml.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: Using the Visual Layer with WinUI XAML
2+
title: Use the Visual Layer with WinUI XAML
33
description: Learn techniques for using the Visual Layer APIs with WinUI XAML content to create advanced animations and effects in Windows App SDK apps.
44
ms.date: 03/16/2026
55
ms.topic: how-to
66
ms.localizationpriority: medium
77
---
8-
# Using the Visual Layer with WinUI XAML
8+
# Use the Visual Layer with WinUI XAML
99

1010
Most WinUI and Windows App SDK apps that consume Visual Layer capabilities will use XAML to define the main UI content. WinUI provides features in the XAML framework and the Visual Layer that make it easier to combine these two technologies to create stunning user experiences.
1111
XAML and Visual Layer interop functionality can be used to create advanced animations and effects not available using XAML APIs alone. This includes:
@@ -19,17 +19,17 @@ XAML and Visual Layer interop functionality can be used to create advanced anima
1919
These effects and animations can be applied to existing XAML content, so you don't have to dramatically restructure your WinUI app to take advantage of the functionality.
2020
Layout animations, shadows, and blur effects are covered in the Recipes section below. For a code sample implementing parallax, see the [ParallaxingListItems sample](https://github.com/microsoft/WindowsCompositionSamples/tree/master/SampleGallery/Samples/SDK%2010586/ParallaxingListItems). The [WindowsCompositionSamples repository](https://github.com/microsoft/WindowsCompositionSamples) also has several other samples for implementing animations, shadows and effects.
2121

22-
## The Microsoft.UI.Xaml.Media.XamlCompositionBrushBase class
22+
## The XamlCompositionBrushBase class
2323

24-
**XamlCompositionBrushBase** provides a base class for XAML brushes that paint an area with a **CompositionBrush**. This can be used to easily apply composition effects like blur or frosted glass to XAML UI elements.
24+
**Microsoft.UI.Xaml.Media.XamlCompositionBrushBase** provides a base class for XAML brushes that paint an area with a **CompositionBrush**. This can be used to easily apply composition effects like blur or frosted glass to XAML UI elements.
2525

2626
See the [**Brushes**](/windows/apps/design/style/brushes#xamlcompositionbrushbase) section for more info on using brushes with XAML UI.
2727

2828
For code examples, see the reference page for [**XamlCompositionBrushBase**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.xamlcompositionbrushbase).
2929

30-
## The Microsoft.UI.Xaml.Media.XamlLight class
30+
## The XamlLight class
3131

32-
**XamlLight** provides a base class for XAML lighting effects that dynamically light an area with a **CompositionLight**.
32+
**Microsoft.UI.Xaml.Media.XamlLight** provides a base class for XAML lighting effects that dynamically light an area with a **CompositionLight**.
3333

3434
See the [**Lighting**](xaml-lighting.md) section for more info on using lights, including lighting XAML UI elements.
3535

@@ -44,15 +44,15 @@ For code examples, see the reference page for [**XamlLight**](/windows/windows-a
4444
- [**GetElementChildVisual**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.hosting.elementcompositionpreview.getelementchildvisual): Retrieve the Visual set using **SetElementChildVisual**
4545
- [**GetScrollViewerManipulationPropertySet**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.hosting.elementcompositionpreview.getscrollviewermanipulationpropertyset): Get an object that can be used to create 60fps animations based on scroll offset in a **ScrollViewer**
4646

47-
## Remarks on ElementCompositionPreview.GetElementVisual
47+
### GetElementVisual
4848

49-
**ElementCompositionPreview.GetElementVisual** returns a handout Visual that is used to render the given **UIElement**. Properties such as **Visual.Opacity**, **Visual.Offset**, and **Visual.Size** are set by the XAML framework based on the state of the UIElement. This enables techniques such as implicit reposition animations (see *Recipes*).
49+
**ElementCompositionPreview.GetElementVisual** returns a "handout" Visual that is used to render the given **UIElement**. Properties such as **Visual.Opacity**, **Visual.Offset**, and **Visual.Size** are set by the XAML framework based on the state of the UIElement. This enables techniques such as implicit reposition animations (see *Recipes*).
5050

5151
Note that since **Offset** and **Size** are set as the result of XAML framework layout, developers should be careful when modifying or animating these properties. Developers should only modify or animate Offset when the element’s top-left corner has the same position as that of its parent in layout. Size should generally not be modified, but accessing the property may be useful. For example, the Drop Shadow and Frosted Glass samples below use Size of a handout Visual as input to an animation.
5252

5353
As an additional caveat, updated properties of the handout Visual will not be reflected in the corresponding UIElement. So for example, setting **UIElement.Opacity** to 0.5 will set the corresponding handout Visual’s Opacity to 0.5. However, setting the handout Visual’s **Opacity** to 0.5 will cause the content to appear at 50% opacity, but will not change the value of the corresponding UIElement’s Opacity property.
5454

55-
### Example of **Offset** animation
55+
### Example of Offset animation
5656

5757
#### Incorrect
5858

@@ -82,11 +82,11 @@ ElementCompositionPreview.GetElementVisual(MyImage).StartAnimation("Offset", par
8282
ElementCompositionPreview.GetElementVisual(MyImage).StartAnimation("Offset", parallaxAnimation);
8383
```
8484

85-
## The **ElementCompositionPreview.SetElementChildVisual** method
85+
### SetElementChildVisual
8686

8787
**ElementCompositionPreview.SetElementChildVisual** allows the developer to supply a “handin” Visual that will appear as part of an element’s Visual Tree. This allows developers to create a “Composition Island” where Visual-based content can appear inside a XAML UI. Developers should be conservative about using this technique because Visual-based content will not have the same accessibility and user experience guarantees of XAML content. Therefore, it is generally recommended that this technique only be used when necessary to implement custom effects such as those found in the Recipes section below.
8888

89-
## **GetAlphaMask** methods
89+
## GetAlphaMask methods
9090

9191
[**Image**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.image), [**TextBlock**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.textblock), and [**Shape**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.shapes.shape) each implement a method called **GetAlphaMask** that returns a **CompositionBrush** representing a grayscale image with the shape of the element. This **CompositionBrush** can serve as an input for a Composition **DropShadow**, so the shadow can reflect the shape of the element instead of a rectangle. This enables pixel perfect, contour-based shadows for text, images with alpha, and shapes. See *Drop Shadow* below for an example of this API.
9292

0 commit comments

Comments
 (0)