UIElement Class

May 11, 2014

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

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

public abstract class UIElement : DependencyObject

The UIElement type exposes the following members.

  NameDescription
Public propertyAllowDropGets or sets a value that determines whether this UIElement can be a drop target for purposes of drag-and-drop operations.
Public propertyCacheModeGets or sets a value that indicates that rendered content should be cached when possible.
Public propertyClipGets or sets the Geometry used to define the outline of the contents of a UIElement.
Public propertyDesiredSizeGets the size that this UIElement computed during the measure pass of the layout process.
Public propertyDispatcherGets the Dispatcher this object is associated with. (Inherited from DependencyObject.)
Public propertyIsHitTestVisibleGets or sets whether the contained area of this UIElement can return true values for hit testing.
Public propertyOpacityGets or sets the degree of the object's opacity.
Public propertyOpacityMaskGets or sets the brush used to alter the opacity of regions of this object.
Public propertyProjectionGets or sets the perspective projection (3-D effect) to apply when rendering this UIElement.
Public propertyRenderSizeGets the final render size of a UIElement.
Public propertyRenderTransformGets or sets transform information that affects the rendering position of a UIElement.
Public propertyRenderTransformOriginGets or sets the origin point of any possible render transform declared by RenderTransform, relative to the bounds of the UIElement.
Public propertyUseLayoutRoundingGets 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.
Public propertyVisibilityGets or sets the visibility of a UIElement. A UIElement that is not visible does not render and does not communicate its desired size to layout.
Top

  NameDescription
Public methodAddHandlerAdds 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 for routed event that had already been marked as handled by another element along the event route.
Public methodArrangePositions 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.
Public methodCaptureMouseSets touch capture to a UIElement.
Public methodCheckAccessDetermines whether the calling thread has access to this object. (Inherited from DependencyObject.)
Public methodClearValueClears the local value of a dependency property. (Inherited from DependencyObject.)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetAnimationBaseValueReturns any base value established for a Windows Phone dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetValueReturns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.)
Public methodInvalidateArrangeInvalidates the arrange state (layout) for a UIElement. After the invalidation, the UIElement will have its layout updated, which will occur asynchronously.
Public methodInvalidateMeasureInvalidates the measurement state (layout) for a UIElement.
Public methodMeasureUpdates 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.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnCreateAutomationPeerWhen implemented in a derived class, returns class-specific AutomationPeer implementations for the Windows Phone automation infrastructure.
Public methodReadLocalValueReturns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.)
Public methodReleaseMouseCaptureRemoves touch capture from a UIElement. After this call, typically no object holds touch capture.
Public methodRemoveHandlerRemoves the specified routed event handler from this UIElement.
Public methodSetValueSets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodTransformToVisualReturns a transform object that can be used to transform coordinates from the UIElement to the specified object.
Public methodUpdateLayoutEnsures that all positions of child objects of a UIElement are properly updated for layout.
Top

  NameDescription
Public eventDoubleTapOccurs when a DoubleTap gesture is committed while over this UIElement.
Public eventGotFocusOccurs when a UIElement receives focus.
Public eventHoldOccurs when a Hold gesture is committed while over this UIElement.
Public eventKeyDownOccurs when a keyboard key is pressed while the UIElement has focus.
Public eventKeyUpOccurs when a keyboard key is released while the UIElement has focus.
Public eventLostFocusOccurs when a UIElement loses focus.
Public eventLostMouseCaptureOccurs when the UIElement loses touch capture.
Public eventManipulationCompletedOccurs when a manipulation and inertia on the UIElement is complete.
Public eventManipulationDeltaOccurs when the input device changes position during a manipulation.
Public eventManipulationStartedOccurs when an input device begins a manipulation on the UIElement.
Public eventMouseEnterOccurs when a screen tap occurs within the bounding area of a UIElement.
Public eventMouseLeaveOccurs when a touch event occurs outside the bounding area of a UIElement.
Public eventMouseLeftButtonDownOccurs when a UIElement is tapped.
Public eventMouseLeftButtonUpOccurs when the finger is lifted off of a UIElement (or while a UIElement holds touch capture).
Public eventMouseMoveOccurs when the coordinate position of the finger on the screen while touching a UIElement (or while a UIElement holds touch capture).
Public eventMouseWheelInfrastructure. Occurs when the user rotates the mouse wheel while the mouse pointer is over a UIElement, or the UIElement has focus.
Public eventTapOccurs when a Tap gesture is committed while over this UIElement.
Public eventTextInputOccurs when a UI element gets text in a device-independent manner.
Public eventTextInputStartOccurs when a UI element initially gets text in a device-independent manner.
Public eventTextInputUpdateOccurs when text continues to be composed via an input method editor (IME).
Top

  NameDescription
Public fieldStatic memberAllowDropPropertyIdentifies the AllowDrop dependency property.
Public fieldStatic memberCacheModePropertyIdentifies the CacheMode dependency property.
Public fieldStatic memberClipPropertyIdentifies the Clip dependency property.
Public fieldStatic memberDoubleTapEventIdentifies the DoubleTap routed event.
Public fieldStatic memberHoldEventIdentifies the Hold routed event.
Public fieldStatic memberIsHitTestVisiblePropertyIdentifies the IsHitTestVisible dependency property.
Public fieldStatic memberKeyDownEventIdentifies the KeyDown routed event.
Public fieldStatic memberKeyUpEventIdentifies the KeyUp routed event.
Public fieldStatic memberManipulationCompletedEventIdentifies the ManipulationCompleted routed event.
Public fieldStatic memberManipulationDeltaEventIdentifies the ManipulationDelta routed event.
Public fieldStatic memberManipulationStartedEventIdentifies the ManipulationStarted routed event.
Public fieldStatic memberMouseLeftButtonDownEventIdentifies the MouseLeftButtonDown routed event.
Public fieldStatic memberMouseLeftButtonUpEventIdentifies the MouseLeftButtonUp routed event.
Public fieldStatic memberOpacityMaskPropertyIdentifies the IsHitTestVisible dependency property.
Public fieldStatic memberOpacityPropertyIdentifies the IsHitTestVisible dependency property.
Public fieldStatic memberProjectionPropertyIdentifies the Projection dependency property.
Public fieldStatic memberRenderTransformOriginPropertyIdentifies the RenderTransformOrigin dependency property.
Public fieldStatic memberRenderTransformPropertyIdentifies the RenderTransform dependency property.
Public fieldStatic memberTapEventIdentifies the Tap routed event.
Public fieldStatic memberTextInputEventIdentifies the TextInput routed event.
Public fieldStatic memberTextInputStartEventIdentifies the TextInputStart routed event.
Public fieldStatic memberTextInputUpdateEventIdentifies the TextInputUpdate routed event.
Public fieldStatic memberUseLayoutRoundingPropertyIdentifies the UseLayoutRounding dependency property.
Public fieldStatic memberVisibilityPropertyIdentifies the Visibility dependency property.
Top

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

Much of the input behavior for visible elements in a wphone  UI is defined in the UIElement class. This includes the events for keyboard, touchscreen input, 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.

Although UIElement defines the events for focus reporting (GotFocus, LostFocus), UIElement does not define an API for programmatically setting the focus. However, this capability is defined by the Control class and is thus present for many of the  elements in a UI.

UIElement does not expose a public constructor. It is not typical to derive from either UIElement or FrameworkElement directly. More typically used base classes for derived custom classes are these classes:

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Show:
© 2014 Microsoft