UIElement class

Expand Minimize
1 out of 3 rated this helpful - Rate this topic

UIElement is a base class for most of the objects that have visual appearance and can process basic input in a user interface.

Inheritance

Object
  DependencyObject
    UIElement

Syntax


public class UIElement : DependencyObject

Attributes

MarshalingBehaviorAttribute(Agile)
StaticAttribute(Windows.UI.Xaml.IUIElementStatics, NTDDI_WIN8)
ThreadingAttribute(Both)
VersionAttribute(NTDDI_WIN8)
WebHostHiddenAttribute()

Members

The UIElement class has these types of members:

Events

The UIElement class has these events.

EventDescription
DoubleTapped Occurs when an otherwise unhandled DoubleTap interaction occurs over the hit test area of this element.
DragEnter Occurs when the input system reports an underlying drag event with this element as the target.
DragLeave Occurs when the input system reports an underlying drag event with this element as the origin.
DragOver Occurs when the input system reports an underlying drag event with this element as the potential drop target.
Drop Occurs when the input system reports an underlying drop event with this element as the drop target.
GotFocus Occurs when a UIElement receives focus.
Holding Occurs when an otherwise unhandled Hold interaction occurs over the hit test area of this element.
KeyDown Occurs when a keyboard key is pressed while the UIElement has focus.
KeyUp Occurs when a keyboard key is released while the UIElement has focus.
LostFocus Occurs when a UIElement loses focus.
ManipulationCompleted Occurs when a manipulation on the UIElement is complete.
ManipulationDelta Occurs when the input device changes position during a manipulation.
ManipulationInertiaStarting Occurs when the input device loses contact with the UIElement object during a manipulation and inertia begins.
ManipulationStarted Occurs when an input device begins a manipulation on the UIElement.
ManipulationStarting Occurs when the manipulation processor is first created.
PointerCanceled Occurs when a pointer that made contact abnormally loses contact.
PointerCaptureLost Occurs when pointer capture previously held by this element moves to another element or elsewhere.
PointerEntered Occurs when a pointer enters the hit test area of this element.
PointerExited Occurs when a pointer leaves the hit test area of this element.
PointerMoved Occurs when a pointer moves while the pointer remains within the hit test area of this element.
PointerPressed Occurs when the pointer device initiates a Press action within this element.
PointerReleased Occurs when the pointer device that previously initiated a Press action is released, while within this element.
PointerWheelChanged Occurs when the delta value of a pointer wheel changes.
RightTapped Occurs when a right-tap input stimulus happens while the pointer is over the element.
Tapped Occurs when an otherwise unhandled Tap interaction occurs over the hit test area of this element.

 

Methods

The UIElement class has these methods. It also inherits methods from the Object class.

MethodDescription
AddHandler Adds a routed event handler for a specified routed event, adding the handler to the handler collection on the current element. Specify handledEventsToo as true to have the provided handler be invoked even if the event is handled elsewhere.
Arrange Positions child objects and determines a size for a UIElement. Parent objects that implement custom layout for their child elements should call this method from their layout override implementations to form a recursive layout update.
CapturePointer Sets pointer capture to a UIElement. Once captured, only the element that has capture will fire pointer-related events.
ClearValue Clears the local value of a dependency property. (Inherited from DependencyObject)
FindSubElementsForTouchTargeting Enables a UIElement subclass to expose child elements that assist with resolving touch targeting.
GetAnimationBaseValue Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject)
GetValue Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject)
InvalidateArrange Invalidates the arrange state (layout) for a UIElement. After the invalidation, the UIElement will have its layout updated, which will occur asynchronously.
InvalidateMeasure Invalidates the measurement state (layout) for a UIElement.
Measure Updates the DesiredSize of a UIElement. Typically, objects that implement custom layout for their layout children call this method from their own MeasureOverride implementations to form a recursive layout update.
OnCreateAutomationPeer When implemented in a derived class, returns class-specific AutomationPeer implementations for the Microsoft UI Automation infrastructure.
OnDisconnectVisualChildren Override this method to implement how layout and logic should behave when items are removed from a class-specific content or children property.
ReadLocalValue Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject)
ReleasePointerCapture Releases pointer captures for capture of one specific pointer by this UIElement.
ReleasePointerCaptures Releases all pointer captures held by this element.
RemoveHandler Removes the specified routed event handler from this UIElement. Typically the handler in question was added by AddHandler.
SetValue Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject)
TransformToVisual Returns a transform object that can be used to transform coordinates from the UIElement to the specified object.
UpdateLayout Ensures that all positions of child objects of a UIElement are properly updated for layout.

 

Properties

The UIElement class has these properties.

PropertyAccess typeDescription

AllowDrop

Read/writeGets or sets a value that determines whether this UIElement can be a drop target for purposes of drag-and-drop operations.

AllowDropProperty

Read-onlyIdentifies the AllowDrop dependency property.

CacheMode

Read/writeGets or sets a value that indicates that rendered content should be cached as a composited bitmap when possible.

CacheModeProperty

Read-onlyIdentifies the CacheMode dependency property.

Clip

Read/writeGets or sets the RectangleGeometry used to define the outline of the contents of a UIElement.

ClipProperty

Read-onlyIdentifies the Clip dependency property.

DesiredSize

Read-onlyGets the size that this UIElement computed during the measure pass of the layout process.

Dispatcher

Read-onlyGets the CoreDispatcher that this object is associated with. (Inherited from DependencyObject)

DoubleTappedEvent

Read-onlyGets the identifier for the DoubleTapped routed event.

DragEnterEvent

Read-onlyGets the identifier for the DragEnter routed event.

DragLeaveEvent

Read-onlyGets the identifier for the DragLeave routed event.

DragOverEvent

Read-onlyGets the identifier for the DragOver routed event.

DropEvent

Read-onlyGets the identifier for the Drop routed event.

HoldingEvent

Read-onlyGets the identifier for the Holding routed event.

IsDoubleTapEnabled

Read/writeGets or sets a value that determines whether the DoubleTapped event can originate from that element.

IsDoubleTapEnabledProperty

Read-onlyIdentifies the IsDoubleTapEnabled dependency property.

IsHitTestVisible

Read/writeGets or sets whether the contained area of this UIElement can return true values for hit testing.

IsHitTestVisibleProperty

Read-onlyIdentifies the IsHitTestVisible dependency property.

IsHoldingEnabled

Read/writeGets or sets a value that determines whether the Holding event can originate from that element.

IsHoldingEnabledProperty

Read-onlyIdentifies the IsHoldingEnabled dependency property.

IsRightTapEnabled

Read/writeGets or sets a value that determines whether the RightTapped event can originate from that element.

IsRightTapEnabledProperty

Read-onlyIdentifies the IsRightTapEnabled dependency property.

IsTapEnabled

Read/writeGets or sets a value that determines whether the Tapped event can originate from that element.

IsTapEnabledProperty

Read-onlyIdentifies the IsTapEnabled dependency property.

KeyDownEvent

Read-onlyGets the identifier for the KeyDown routed event.

KeyUpEvent

Read-onlyGets the identifier for the KeyUp routed event.

ManipulationCompletedEvent

Read-onlyGets the identifier for the ManipulationCompleted routed event.

ManipulationDeltaEvent

Read-onlyGets the identifier for the ManipulationDelta routed event.

ManipulationInertiaStartingEvent

Read-onlyGets the identifier for the ManipulationInertiaStarting routed event.

ManipulationMode

Read/writeGets or sets the ManipulationModes value used for UIElement behavior and interaction with gestures.

ManipulationModeProperty

Read-onlyIdentifies the ManipulationMode dependency property.

ManipulationStartedEvent

Read-onlyGets the identifier for the ManipulationStarted routed event.

ManipulationStartingEvent

Read-onlyGets the identifier for the ManipulationStarting routed event.

Opacity

Read/writeGets or sets the degree of the object's opacity.

OpacityProperty

Read-onlyIdentifies the IsHitTestVisible dependency property.

PointerCanceledEvent

Read-onlyGets the identifier for the PointerCanceled routed event.

PointerCaptureLostEvent

Read-onlyGets the identifier for the PointerCaptureLost routed event.

PointerCaptures

Read-onlyGets the set of all captured pointers, represented as Pointer values.

PointerCapturesProperty

Read-onlyIdentifies the PointerCaptures dependency property.

PointerEnteredEvent

Read-onlyGets the identifier for the PointerEntered routed event.

PointerExitedEvent

Read-onlyGets the identifier for the PointerExited routed event.

PointerMovedEvent

Read-onlyGets the identifier for the PointerMoved routed event.

PointerPressedEvent

Read-onlyGets the identifier for the PointerPressed routed event.

PointerReleasedEvent

Read-onlyGets the identifier for the PointerReleased routed event.

PointerWheelChangedEvent

Read-onlyGets the identifier for the PointerWheelChanged routed event.

Projection

Read/writeGets or sets the perspective projection (3-D effect) to apply when rendering this element.

ProjectionProperty

Read-onlyIdentifies the Projection dependency property.

RenderSize

Read-onlyGets the final render size of a UIElement.

RenderTransform

Read/writeGets or sets transform information that affects the rendering position of a UIElement.

RenderTransformOrigin

Read/writeGets or sets the origin point of any possible render transform declared by RenderTransform, relative to the bounds of the UIElement.

RenderTransformOriginProperty

Read-onlyIdentifies the RenderTransformOrigin dependency property.

RenderTransformProperty

Read-onlyIdentifies the RenderTransform dependency property.

RightTappedEvent

Read-onlyGets the identifier for the RightTapped routed event.

TappedEvent

Read-onlyGets the identifier for the Tapped routed event.

Transitions

Read/writeGets or sets the collection of Transition style elements that apply to a UIElement.

TransitionsProperty

Read-onlyIdentifies the Transitions dependency property.

UseLayoutRounding

Read/writeGets or sets a value that determines whether rendering for the object and its visual subtree should use rounding behavior that aligns rendering to whole pixels.

UseLayoutRoundingProperty

Read-onlyIdentifies the UseLayoutRounding dependency property.

Visibility

Read/writeGets or sets the visibility of a UIElement. A UIElement that is not visible is not rendered and does not communicate its desired size to layout.

VisibilityProperty

Read-onlyIdentifies the Visibility dependency property.

 

Remarks

UIElement provides a starting point for layout characteristics. FrameworkElement adds more layout capabilities.

Much of the input behavior for visible elements in a UI is defined in the UIElement class. This includes the events for keyboard, pointers, touch, manipulations, and focus events. Some of these events are routed events. A routed event enables a built-in event handling notification system, so that a parent object can handle input events from child objects in the object tree if the event remains unhandled. This input event behavior is useful for input area grouping, and for control compositing. For more info, see Events and routed events overview.

UIElement has properties that can influence the element's preferences for processing input. For example, you can enable the element to be a drop target with AllowDrop, or disable tap response with IsTapEnabled.

Although UIElement defines the events for focus reporting (GotFocus, LostFocus), UIElement does not define an API for programmatically setting the focus. This capability is defined by the Control class.

UIElement does not expose a public constructor. Typically, you don't derive classes from either UIElement or FrameworkElement directly. More typically used base classes for derived custom classes are these classes:

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.winmd

See also

DependencyObject

 

 

Build date: 1/31/2013

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.