Jaa


Visual Class

Definition

The base visual object in the visual hierarchy.

public ref class Visual : CompositionObject
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class Visual : CompositionObject
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 131072)]
class Visual : CompositionObject
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public class Visual : CompositionObject
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 131072)]
public class Visual : CompositionObject
Public Class Visual
Inherits CompositionObject
Inheritance
Object Platform::Object IInspectable CompositionObject Visual
Derived
Attributes

Windows requirements

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

Remarks

Visual objects compose and render serialized drawing content and form the basis of a retained mode visual system. The Visual class supports basic position and clipping and can have 2D and 3D transformations applied to them. Additional functionality like solid colors, images, and content with effects is provided through subclasses like SpriteVisual or ContainerVisual, and by setting the Brush property of the visual to CompositionBrush subclasses such as CompositionColorBrush, CompositionEffectBrush, or CompositionSurfaceBrush.

Visual objects are thread-agile and not bound to the UI thread.

Animatable properties

The following properties can be animated. Call CompositionObject.StartAnimation to associate the property with a CompositionAnimation.

Rotation

Visual supports two forms of rotation:

  • axis-angle

    Axis-angle rotation uses the RotationAngle, RotationAxis, and CenterPoint properties to specify the rotation in degrees, which axis to rotate around, and the center point of the visual to rotate around.

  • orientation

    Rotation by orientation uses the Orientation property to specify a quaternion describing an orientation and rotation in 3D space.

Version history

Windows version SDK version Value added
1703 15063 ParentForTransform
1703 15063 RelativeOffsetAdjustment
1703 15063 RelativeSizeAdjustment

Properties

AnchorPoint

The point on the visual to be positioned at the visual's offset. Value is normalized with respect to the size of the visual. Animatable.

BackfaceVisibility

Specifies whether the back face of the visual should be visible during a 3D transform.

BorderMode

Specifies how to compose the edges of bitmaps and clips associated with a visual, or with all visuals in the subtree rooted at this visual. Setting BorderMode at a parent Visual will affect all children visuals in the subtree and can be selectively turned off at each child visual.

CenterPoint

The point about which rotation or scaling occurs. Animatable

Clip

Specifies the clipping region for the visual. When a visual is rendered, only the portion of the visual that falls inside the clipping region is displayed, while any content that extends outside the clipping region is clipped (that is, not displayed).

Comment

A string to associate with the CompositionObject.

(Inherited from CompositionObject)
CompositeMode

Specifies how a visual's bitmap is blended with the screen.

Compositor

The Compositor used to create this CompositionObject.

(Inherited from CompositionObject)
Dispatcher

The dispatcher for the CompositionObject.

(Inherited from CompositionObject)
DispatcherQueue

Gets the DispatcherQueue for the CompostionObject.

(Inherited from CompositionObject)
ImplicitAnimations

The collection of implicit animations attached to this object.

(Inherited from CompositionObject)
IsHitTestVisible

Gets or sets a value that indicates whether the visual sub-tree rooted at this visual participates in hit testing.

IsPixelSnappingEnabled

Gets or sets a value that indicates whether the composition engine aligns the rendered visual with a pixel boundary.

IsVisible

Indicates whether the visual and its entire subtree of child visuals is visible.

Offset

The offset of the visual relative to its parent or for a root visual the offset relative to the upper-left corner of the windows that hosts the visual. Animatable.

Opacity

The opacity of the visual. Animatable.

The opacity property determines the transparency, if any, of the Visual and is a value from 0 to 1. 0 is fully transparent and 1 is full opaque. A Visual with an Opacity property of 0 is still present in the tree. Like other properties on the Visual, Opacity can be animated using the Windows,UI.Composition animation system.

Orientation

A quaternion describing an orientation and rotation in 3D space that will be applied to the visual. Animatable.

Parent

The parent of the visual.

ParentForTransform

Visual specifying the coordinate system in which this visual is composed.

Properties

The collection of properties associated with the CompositionObject.

(Inherited from CompositionObject)
RelativeOffsetAdjustment

Specifies the offset of the visual with respect to the size of its parent visual.

RelativeSizeAdjustment

Gets or sets the size of the visual with respect to the size of its parent visual.

RotationAngle

The rotation angle in radians of the visual. Animatable.

RotationAngleInDegrees

The rotation angle of the visual in degrees. Animatable.

RotationAxis

The axis to rotate the visual around. Animatable.

Scale

The scale to apply to the visual.

Size

The width and height of the visual. Animatable.

TransformMatrix

The transformation matrix to apply to the visual. Animatable.

Methods

Close()

Closes the CompositionObject and releases system resources.

(Inherited from CompositionObject)
ConnectAnimation(String, CompositionAnimation)

Connects and animation.

(Inherited from CompositionObject)
DisconnectAnimation(String)

Disconnects an animation.

(Inherited from CompositionObject)
Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

(Inherited from CompositionObject)
PopulatePropertyInfo(String, AnimationPropertyInfo)

Defines a property that can be animated.

(Inherited from CompositionObject)
StartAnimation(String, CompositionAnimation, AnimationController)

Connects an animation with the specified property of the object and starts the animation.

(Inherited from CompositionObject)
StartAnimation(String, CompositionAnimation)

Connects an animation with the specified property of the object and starts the animation.

(Inherited from CompositionObject)
StartAnimationGroup(ICompositionAnimationBase)

Starts an animation group.

The StartAnimationGroup method on CompositionObject lets you start CompositionAnimationGroup. All the animations in the group will be started at the same time on the object.

(Inherited from CompositionObject)
StopAnimation(String)

Disconnects an animation from the specified property and stops the animation.

(Inherited from CompositionObject)
StopAnimationGroup(ICompositionAnimationBase)

Stops an animation group.

(Inherited from CompositionObject)
TryGetAnimationController(String)

Returns an AnimationController for the animation running on the specified property.

(Inherited from CompositionObject)

Applies to

See also