ElementCompositionPreview Class

Definition

Enables access to composition visual objects that back XAML elements in the XAML composition tree.

Equivalent WinUI class: Microsoft.UI.Xaml.Hosting.ElementCompositionPreview.

public ref class ElementCompositionPreview sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Static(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
class ElementCompositionPreview sealed
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 131072)]
/// [Windows.Foundation.Metadata.Static(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics, 131072, "Windows.Foundation.UniversalApiContract")]
class ElementCompositionPreview sealed
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 131072)]
/// [Windows.Foundation.Metadata.Static(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics, 131072, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Static(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics2, 262144, "Windows.Foundation.UniversalApiContract")]
class ElementCompositionPreview sealed
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 131072)]
/// [Windows.Foundation.Metadata.Static(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics, 131072, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Static(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics2, 262144, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Static(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics3, 524288, "Windows.Foundation.UniversalApiContract")]
class ElementCompositionPreview sealed
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Static(typeof(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
public sealed class ElementCompositionPreview
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 131072)]
[Windows.Foundation.Metadata.Static(typeof(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics), 131072, "Windows.Foundation.UniversalApiContract")]
public sealed class ElementCompositionPreview
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 131072)]
[Windows.Foundation.Metadata.Static(typeof(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics), 131072, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Static(typeof(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics2), 262144, "Windows.Foundation.UniversalApiContract")]
public sealed class ElementCompositionPreview
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 131072)]
[Windows.Foundation.Metadata.Static(typeof(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics), 131072, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Static(typeof(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics2), 262144, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Static(typeof(Windows.UI.Xaml.Hosting.IElementCompositionPreviewStatics3), 524288, "Windows.Foundation.UniversalApiContract")]
public sealed class ElementCompositionPreview
Public NotInheritable Class ElementCompositionPreview
Inheritance
ElementCompositionPreview
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

ElementCompositionPreview allows access to the Windows.UI.Composition.Visual object backing a XAML element with the GetElementVisual method. Once the backing object has been retrieved it can be manipulated using the Windows.UI.Composition namespace. This allows properties of the object to be changed, like the orientation, or additional objects to be added to the XAML composition tree.

Version history

Windows version SDK version Value added
1703 15063 GetPointerPositionPropertySet
1703 15063 SetImplicitHideAnimation
1703 15063 SetImplicitShowAnimation
1703 15063 SetIsTranslationEnabled
1903 18362 GetAppWindowContent
1903 18362 SetAppWindowContent

Methods

GetAppWindowContent(AppWindow)

Retrieves the content root of an AppWindow.

GetContainerVisual(UIElement)
GetElementChildVisual(UIElement)

Retrieves a Windows.UI.Composition.Visual object previously set by a call to SetElementChildVisual.

Equivalent WinUI method: Microsoft.UI.Xaml.Hosting.ElementCompositionPreview.GetElementChildVisual.

GetElementVisual(UIElement)

Retrieves the Windows.UI.Composition.Visual object that backs a XAML element in the XAML composition tree.

Equivalent WinUI method: Microsoft.UI.Xaml.Hosting.ElementCompositionPreview.GetElementVisual.

GetPointerPositionPropertySet(UIElement)

Retrieves the pointer position relative to a UIElement.

Equivalent WinUI method: Microsoft.UI.Xaml.Hosting.ElementCompositionPreview.GetPointerPositionPropertySet.

GetScrollViewerManipulationPropertySet(ScrollViewer)

Retrieves the composition properties of a ScrollViewer element.

Equivalent WinUI method: Microsoft.UI.Xaml.Hosting.ElementCompositionPreview.GetScrollViewerManipulationPropertySet.

SetAppWindowContent(AppWindow, UIElement)

Sets a XAML UIElement as the content root of an AppWindow.

SetElementChildVisual(UIElement, Visual)

Sets a custom Windows.UI.Composition.Visual as the last child of the element’s visual tree.

Equivalent WinUI method: Microsoft.UI.Xaml.Hosting.ElementCompositionPreview.SetElementChildVisual.

SetImplicitHideAnimation(UIElement, ICompositionAnimationBase)

Associates the specified hide animation with a UIElement.

Equivalent WinUI method: Microsoft.UI.Xaml.Hosting.ElementCompositionPreview.SetImplicitHideAnimation.

SetImplicitShowAnimation(UIElement, ICompositionAnimationBase)

Associates the specified show animation with a UIElement.

Equivalent WinUI method: Microsoft.UI.Xaml.Hosting.ElementCompositionPreview.SetImplicitShowAnimation.

SetIsTranslationEnabled(UIElement, Boolean)

Toggles the ability to set, animate, and use a render-time post-layout translate transform to position XAML elements on screen using Composition APIs.

Equivalent WinUI method: Microsoft.UI.Xaml.Hosting.ElementCompositionPreview.SetIsTranslationEnabled.

Applies to