Visual Visual Visual Visual Class

Definition

Provides rendering support in WPF, which includes hit testing, coordinate transformation, and bounding box calculations.

public ref class Visual abstract : System::Windows::DependencyObject
public abstract class Visual : System.Windows.DependencyObject
type Visual = class
    inherit DependencyObject
    interface DUCE.IResource
Public MustInherit Class Visual
Inherits DependencyObject
Inheritance
Derived

Remarks

The Visual class is the basic abstraction from which every FrameworkElement object derives. It also serves as the entry point for writing new controls in WPF, and in many ways can be thought of as an equivalent of a window handle (HWND) in the Win32 application model.

The Visual object is a core WPF object, whose primary role is to provide rendering support. User interface controls, such as Button and TextBox, derive from the Visual class, and use the Visual defined properties for persisting their rendering data. The Visual object provides support for the following:

  • Output display: Rendering the persisted, serialized drawing content of a visual.

  • Transformations: Performing transformations on a visual.

  • Clipping: Providing clipping region support for a visual.

  • Hit testing: Determining whether a specified coordinate (point) or geometry is contained within the bounds of a visual.

  • Bounding box calculations: Determining the bounding rectangle of a visual.

Architecturally, the Visual object does not include support for other application development requirements / WPF features that are not immediately related to its rendering, such as the following:

  • Event handling

  • Layout

  • Styles

  • Data binding

  • Globalization

Visual is provided as a public abstract class from which further classes can be derived. The following illustration shows the hierarchy of the existing visual objects that are defined in the WPF architecture.

Diagram of classes derived from the Visual object
Visual class hierarchy

In some cases, members that are defined as protected in Visual are exposed as more readily accessible members with similar names in the derived UIElement class.

For more information, see WPF Graphics Rendering Overview.

A Visual has a limited number of levels. In previous versions of the .NET Framework, this maximum depth was 255. This limit is inadequate for some layouts that have many levels in the visual tree.

In .NET Framework 4, the maximum depth of a Visual is 2047, which enables much deeper visual trees. In most applications, there is not enough stack space to traverse so many levels, and the result is a StackOverflowException during layout. For the default stack size, this exception is usually thrown when the tree depth is approximately 800, which corresponds to about 190 nested TreeViewItem objects.

If this exception is thrown by your application and you need to have a deeper visual tree, you can increase the application's stack size. You can increase the size of the stack by using the /STACK option at compile time or by using the EDITBIN utility. Increasing the stack size may affect your application's performance. For more information, see Stack Allocations and EDITBIN Options.

Constructors

Visual() Visual() Visual() Visual()

Provides the base initialization for objects derived from the Visual class.

Properties

DependencyObjectType DependencyObjectType DependencyObjectType DependencyObjectType

Gets the DependencyObjectType that wraps the CLR type of this instance.

(Inherited from DependencyObject)
Dispatcher Dispatcher Dispatcher Dispatcher

Gets the Dispatcher this DispatcherObject is associated with.

(Inherited from DispatcherObject)
IsSealed IsSealed IsSealed IsSealed

Gets a value that indicates whether this instance is currently sealed (read-only).

(Inherited from DependencyObject)
VisualBitmapEffect VisualBitmapEffect VisualBitmapEffect VisualBitmapEffect

Gets or sets the BitmapEffect value for the Visual.

VisualBitmapEffectInput VisualBitmapEffectInput VisualBitmapEffectInput VisualBitmapEffectInput

Gets or sets the BitmapEffectInput value for the Visual.

VisualBitmapScalingMode VisualBitmapScalingMode VisualBitmapScalingMode VisualBitmapScalingMode

Gets or sets the BitmapScalingMode for the Visual.

VisualCacheMode VisualCacheMode VisualCacheMode VisualCacheMode

Gets or sets a cached representation of the Visual.

VisualChildrenCount VisualChildrenCount VisualChildrenCount VisualChildrenCount

Gets the number of child elements for the Visual.

VisualClearTypeHint VisualClearTypeHint VisualClearTypeHint VisualClearTypeHint

Gets or sets the ClearTypeHint that determines how ClearType is rendered in the Visual.

VisualClip VisualClip VisualClip VisualClip

Gets or sets the clip region of the Visual as a Geometry value.

VisualEdgeMode VisualEdgeMode VisualEdgeMode VisualEdgeMode

Gets or sets the edge mode of the Visual as an EdgeMode value.

VisualEffect VisualEffect VisualEffect VisualEffect

Gets or sets the bitmap effect to apply to the Visual.

VisualOffset VisualOffset VisualOffset VisualOffset

Gets or sets the offset value of the visual object.

VisualOpacity VisualOpacity VisualOpacity VisualOpacity

Gets or sets the opacity of the Visual.

VisualOpacityMask VisualOpacityMask VisualOpacityMask VisualOpacityMask

Gets or sets the Brush value that represents the opacity mask of the Visual.

VisualParent VisualParent VisualParent VisualParent

Gets the visual tree parent of the visual object.

VisualScrollableAreaClip VisualScrollableAreaClip VisualScrollableAreaClip VisualScrollableAreaClip

Gets or sets a clipped scrollable area for the Visual.

VisualTextHintingMode VisualTextHintingMode VisualTextHintingMode VisualTextHintingMode

Gets or sets the TextHintingMode of the Visual.

VisualTextRenderingMode VisualTextRenderingMode VisualTextRenderingMode VisualTextRenderingMode

Gets or sets the TextRenderingMode of the Visual.

VisualTransform VisualTransform VisualTransform VisualTransform

Gets or sets the Transform value for the Visual.

VisualXSnappingGuidelines VisualXSnappingGuidelines VisualXSnappingGuidelines VisualXSnappingGuidelines

Gets or sets the x-coordinate (vertical) guideline collection.

VisualYSnappingGuidelines VisualYSnappingGuidelines VisualYSnappingGuidelines VisualYSnappingGuidelines

Gets or sets the y-coordinate (horizontal) guideline collection.

Methods

AddVisualChild(Visual) AddVisualChild(Visual) AddVisualChild(Visual) AddVisualChild(Visual)

Defines the parent-child relationship between two visuals.

CheckAccess() CheckAccess() CheckAccess() CheckAccess()

Determines whether the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)
ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier.

(Inherited from DependencyObject)
ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey)

Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey.

(Inherited from DependencyObject)
CoerceValue(DependencyProperty) CoerceValue(DependencyProperty) CoerceValue(DependencyProperty) CoerceValue(DependencyProperty)

Coerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.

(Inherited from DependencyObject)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether a provided DependencyObject is equivalent to the current DependencyObject.

(Inherited from DependencyObject)
FindCommonVisualAncestor(DependencyObject) FindCommonVisualAncestor(DependencyObject) FindCommonVisualAncestor(DependencyObject) FindCommonVisualAncestor(DependencyObject)

Returns the common ancestor of two visual objects.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Gets a hash code for this DependencyObject.

(Inherited from DependencyObject)
GetLocalValueEnumerator() GetLocalValueEnumerator() GetLocalValueEnumerator() GetLocalValueEnumerator()

Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.

(Inherited from DependencyObject)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

Returns the current effective value of a dependency property on this instance of a DependencyObject.

(Inherited from DependencyObject)
GetVisualChild(Int32) GetVisualChild(Int32) GetVisualChild(Int32) GetVisualChild(Int32)

Returns the specified Visual in the parent VisualCollection.

HitTestCore(GeometryHitTestParameters) HitTestCore(GeometryHitTestParameters) HitTestCore(GeometryHitTestParameters) HitTestCore(GeometryHitTestParameters)

Determines whether a geometry value is within the bounds of the visual object.

HitTestCore(PointHitTestParameters) HitTestCore(PointHitTestParameters) HitTestCore(PointHitTestParameters) HitTestCore(PointHitTestParameters)

Determines whether a point coordinate value is within the bounds of the visual object.

InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty)

Re-evaluates the effective value for the specified dependency property

(Inherited from DependencyObject)
IsAncestorOf(DependencyObject) IsAncestorOf(DependencyObject) IsAncestorOf(DependencyObject) IsAncestorOf(DependencyObject)

Determines whether the visual object is an ancestor of the descendant visual object.

IsDescendantOf(DependencyObject) IsDescendantOf(DependencyObject) IsDescendantOf(DependencyObject) IsDescendantOf(DependencyObject)

Determines whether the visual object is a descendant of the ancestor visual object.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnDpiChanged(DpiScale, DpiScale) OnDpiChanged(DpiScale, DpiScale) OnDpiChanged(DpiScale, DpiScale) OnDpiChanged(DpiScale, DpiScale)

Called when the DPI at which this View is rendered changes.

OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs)

Invoked whenever the effective value of any dependency property on this DependencyObject has been updated. The specific dependency property that changed is reported in the event data.

(Inherited from DependencyObject)
OnVisualChildrenChanged(DependencyObject, DependencyObject) OnVisualChildrenChanged(DependencyObject, DependencyObject) OnVisualChildrenChanged(DependencyObject, DependencyObject) OnVisualChildrenChanged(DependencyObject, DependencyObject)

Called when the VisualCollection of the visual object is modified.

OnVisualParentChanged(DependencyObject) OnVisualParentChanged(DependencyObject) OnVisualParentChanged(DependencyObject) OnVisualParentChanged(DependencyObject)

Called when the parent of the visual object is changed.

PointFromScreen(Point) PointFromScreen(Point) PointFromScreen(Point) PointFromScreen(Point)

Converts a Point in screen coordinates into a Point that represents the current coordinate system of the Visual.

PointToScreen(Point) PointToScreen(Point) PointToScreen(Point) PointToScreen(Point)

Converts a Point that represents the current coordinate system of the Visual into a Point in screen coordinates.

ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

Returns the local value of a dependency property, if it exists.

(Inherited from DependencyObject)
RemoveVisualChild(Visual) RemoveVisualChild(Visual) RemoveVisualChild(Visual) RemoveVisualChild(Visual)

Removes the parent-child relationship between two visuals.

SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object)

Sets the value of a dependency property without changing its value source.

(Inherited from DependencyObject)
SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object)

Sets the local value of a dependency property, specified by its dependency property identifier.

(Inherited from DependencyObject)
SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object)

Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.

(Inherited from DependencyObject)
ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty)

Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.

(Inherited from DependencyObject)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)
TransformToAncestor(Visual) TransformToAncestor(Visual) TransformToAncestor(Visual) TransformToAncestor(Visual)

Returns a transform that can be used to transform coordinates from the Visual to the specified Visual ancestor of the visual object.

TransformToAncestor(Visual3D) TransformToAncestor(Visual3D) TransformToAncestor(Visual3D) TransformToAncestor(Visual3D)

Returns a transform that can be used to transform coordinates from the Visual to the specified Visual3D ancestor of the visual object.

TransformToDescendant(Visual) TransformToDescendant(Visual) TransformToDescendant(Visual) TransformToDescendant(Visual)

Returns a transform that can be used to transform coordinates from the Visual to the specified visual object descendant.

TransformToVisual(Visual) TransformToVisual(Visual) TransformToVisual(Visual) TransformToVisual(Visual)

Returns a transform that can be used to transform coordinates from the Visual to the specified visual object.

VerifyAccess() VerifyAccess() VerifyAccess() VerifyAccess()

Enforces that the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)

Applies to

See Also