ElementCompositionPreview ElementCompositionPreview ElementCompositionPreview Class

Definition

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

public : sealed class ElementCompositionPreview : IElementCompositionPreview
public sealed class ElementCompositionPreview : IElementCompositionPreview
Public NotInheritable Class ElementCompositionPreview Implements IElementCompositionPreview
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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.

Methods

GetElementChildVisual(UIElement) GetElementChildVisual(UIElement) GetElementChildVisual(UIElement)

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

public : static Visual GetElementChildVisual(UIElement element)
public static Visual GetElementChildVisual(UIElement element)
Public Static Function GetElementChildVisual(element As UIElement) As Visual
Parameters
element
UIElement UIElement UIElement

The element to retrieve the Visual for.

Returns
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

GetElementVisual(UIElement) GetElementVisual(UIElement) GetElementVisual(UIElement)

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

public : static Visual GetElementVisual(UIElement element)
public static Visual GetElementVisual(UIElement element)
Public Static Function GetElementVisual(element As UIElement) As Visual
Parameters
element
UIElement UIElement UIElement

The element to retrieve the Visual for.

Returns

The Windows.UI.Composition.Visual object that backs the XAML element.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

GetPointerPositionPropertySet(UIElement) GetPointerPositionPropertySet(UIElement) GetPointerPositionPropertySet(UIElement)

Retrieves the pointer position relative to a UIElement.

public : static CompositionPropertySet GetPointerPositionPropertySet(UIElement targetElement)
public static CompositionPropertySet GetPointerPositionPropertySet(UIElement targetElement)
Public Static Function GetPointerPositionPropertySet(targetElement As UIElement) As CompositionPropertySet
Parameters
targetElement
UIElement UIElement UIElement

The element that the pointer position is relative to.

Returns

The position properties of the pointer.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

GetScrollViewerManipulationPropertySet(ScrollViewer) GetScrollViewerManipulationPropertySet(ScrollViewer) GetScrollViewerManipulationPropertySet(ScrollViewer)

Retrieves the composition properties of a ScrollViewer element.

public : static CompositionPropertySet GetScrollViewerManipulationPropertySet(ScrollViewer scrollViewer)
public static CompositionPropertySet GetScrollViewerManipulationPropertySet(ScrollViewer scrollViewer)
Public Static Function GetScrollViewerManipulationPropertySet(scrollViewer As ScrollViewer) As CompositionPropertySet
Parameters
scrollViewer
ScrollViewer ScrollViewer ScrollViewer

The ScrollViewer element to get the composition properties for.

Returns
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

SetElementChildVisual(UIElement, Visual) SetElementChildVisual(UIElement, Visual) SetElementChildVisual(UIElement, Visual)

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

public : static void SetElementChildVisual(UIElement element, Visual visual)
public static void SetElementChildVisual(UIElement element, Visual visual)
Public Static Function SetElementChildVisual(element As UIElement, visual As Visual) As void
Parameters
element
UIElement UIElement UIElement

The element to add the child Visual to.

visual
Visual Visual Visual

The Visual to add to the element's visual tree.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

Remarks

The Visual is added as the last child, therefore on top of the rest of the element in z-order.

SetImplicitHideAnimation(UIElement, ICompositionAnimationBase) SetImplicitHideAnimation(UIElement, ICompositionAnimationBase) SetImplicitHideAnimation(UIElement, ICompositionAnimationBase)

Associates the specified hide animation with a UIElement.

public : static void SetImplicitHideAnimation(UIElement element, ICompositionAnimationBase animation)
public static void SetImplicitHideAnimation(UIElement element, ICompositionAnimationBase animation)
Public Static Function SetImplicitHideAnimation(element As UIElement, animation As ICompositionAnimationBase) As void
Parameters
element
UIElement UIElement UIElement

The UIElement to associate the animation with.

animation
ICompositionAnimationBase ICompositionAnimationBase ICompositionAnimationBase

The animation to play when the UIElement is hidden. A Null value prevents hide animations from playing for this element until the method is called again with an animation value.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Remarks

When an element is removed from the scene or its Visibility property becomes Visibility.Collapsed, the element and all of its descendents in the UI tree will play their hide animations.

SetImplicitShowAnimation(UIElement, ICompositionAnimationBase) SetImplicitShowAnimation(UIElement, ICompositionAnimationBase) SetImplicitShowAnimation(UIElement, ICompositionAnimationBase)

Associates the specified show animation with a UIElement.

public : static void SetImplicitShowAnimation(UIElement element, ICompositionAnimationBase animation)
public static void SetImplicitShowAnimation(UIElement element, ICompositionAnimationBase animation)
Public Static Function SetImplicitShowAnimation(element As UIElement, animation As ICompositionAnimationBase) As void
Parameters
element
UIElement UIElement UIElement

The UIElement to associate the animation with.

animation
ICompositionAnimationBase ICompositionAnimationBase ICompositionAnimationBase

The animation to play when the UIElement is shown. A Null value prevents show animations from playing for this element until the method is called again with an animation value.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Remarks

When an element is added to the scene or its Visibility property becomes Visibility.Visible, the element and all of its descendents in the UI tree will play their show animations.

SetIsTranslationEnabled(UIElement, Boolean) SetIsTranslationEnabled(UIElement, Boolean) 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.

public : static void SetIsTranslationEnabled(UIElement element, bool value)
public static void SetIsTranslationEnabled(UIElement element, Boolean value)
Public Static Function SetIsTranslationEnabled(element As UIElement, value As Boolean) As void
Parameters
element
UIElement UIElement UIElement

The element on which to enable or disable translate transforms.

value
bool Boolean Boolean

true to enable translate transforms; false to disable translate transforms.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)