UIElement Class
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
UIElement is a base class for most of the objects that have visual appearance and can process basic input.
System.Windows::DependencyObject
System.Windows::UIElement
System.Windows::FrameworkElement
Assembly: System.Windows (in System.Windows.dll)
The UIElement type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | AllowDrop | Gets or sets a value that determines whether this UIElement can be a drop target for purposes of drag-and-drop operations. |
![]() | CacheMode | Gets or sets a value that indicates that rendered content should be cached when possible. |
![]() | Clip | Gets or sets the Geometry used to define the outline of the contents of a UIElement. |
![]() | DesiredSize | Gets the size that this UIElement computed during the measure pass of the layout process. |
![]() | Dispatcher | Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.) |
![]() | IsHitTestVisible | Gets or sets whether the contained area of this UIElement can return true values for hit testing. |
![]() | Opacity | Gets or sets the degree of the object's opacity. |
![]() | OpacityMask | Gets or sets the brush used to alter the opacity of regions of this object. |
![]() | Projection | Gets or sets the perspective projection (3-D effect) to apply when rendering this UIElement. |
![]() | RenderSize | Gets the final render size of a UIElement. |
![]() | RenderTransform | Gets or sets transform information that affects the rendering position of a UIElement. |
![]() | RenderTransformOrigin | Gets or sets the origin point of any possible render transform declared by RenderTransform, relative to the bounds of the UIElement. |
![]() | UseLayoutRounding | Gets 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. |
![]() | Visibility | Gets 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. |
| Name | Description | |
|---|---|---|
![]() | 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 for routed event that had already been marked as handled by another element along the event route. |
![]() | 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. |
![]() | CaptureMouse | Sets touch capture to a UIElement. |
![]() | CheckAccess | Determines whether the calling thread has access to this object. (Inherited from DependencyObject.) |
![]() | ClearValue | Clears the local value of a dependency property. (Inherited from DependencyObject.) |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetAnimationBaseValue | Returns any base value established for a Windows Phone dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | 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. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | OnCreateAutomationPeer | When implemented in a derived class, returns class-specific AutomationPeer implementations for the Windows Phone automation infrastructure. |
![]() | ReadLocalValue | Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.) |
![]() | ReleaseMouseCapture | Removes touch capture from a UIElement. After this call, typically no object holds touch capture. |
![]() | RemoveHandler | Removes the specified routed event handler from this UIElement. |
![]() | SetValue | Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() | 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. |
| Name | Description | |
|---|---|---|
![]() | DoubleTap | Occurs when a DoubleTap gesture is committed while over this UIElement. |
![]() | GotFocus | Occurs when a UIElement receives focus. |
![]() | Hold | Occurs when a Hold gesture is committed while over this UIElement. |
![]() | 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. |
![]() | LostMouseCapture | Occurs when the UIElement loses touch capture. |
![]() | ManipulationCompleted | Occurs when a manipulation and inertia on the UIElement is complete. |
![]() | ManipulationDelta | Occurs when the input device changes position during a manipulation. |
![]() | ManipulationStarted | Occurs when an input device begins a manipulation on the UIElement. |
![]() | MouseEnter | Occurs when a screen tap occurs within the bounding area of a UIElement. |
![]() | MouseLeave | Occurs when a touch event occurs outside the bounding area of a UIElement. |
![]() | MouseLeftButtonDown | Occurs when a UIElement is tapped. |
![]() | MouseLeftButtonUp | Occurs when the finger is lifted off of a UIElement (or while a UIElement holds touch capture). |
![]() | MouseMove | Occurs when the coordinate position of the finger on the screen while touching a UIElement (or while a UIElement holds touch capture). |
![]() | MouseWheel | Infrastructure. Occurs when the user rotates the mouse wheel while the mouse pointer is over a UIElement, or the UIElement has focus. |
![]() | Tap | Occurs when a Tap gesture is committed while over this UIElement. |
![]() | TextInput | Occurs when a UI element gets text in a device-independent manner. |
![]() | TextInputStart | Occurs when a UI element initially gets text in a device-independent manner. |
![]() | TextInputUpdate | Occurs when text continues to be composed via an input method editor (IME). |
| Name | Description | |
|---|---|---|
![]() ![]() | AllowDropProperty | Identifies the AllowDrop dependency property. |
![]() ![]() | CacheModeProperty | Identifies the CacheMode dependency property. |
![]() ![]() | ClipProperty | Identifies the Clip dependency property. |
![]() ![]() | DoubleTapEvent | Identifies the DoubleTap routed event. |
![]() ![]() | HoldEvent | Identifies the Hold routed event. |
![]() ![]() | IsHitTestVisibleProperty | Identifies the IsHitTestVisible dependency property. |
![]() ![]() | KeyDownEvent | Identifies the KeyDown routed event. |
![]() ![]() | KeyUpEvent | Identifies the KeyUp routed event. |
![]() ![]() | ManipulationCompletedEvent | Identifies the ManipulationCompleted routed event. |
![]() ![]() | ManipulationDeltaEvent | Identifies the ManipulationDelta routed event. |
![]() ![]() | ManipulationStartedEvent | Identifies the ManipulationStarted routed event. |
![]() ![]() | MouseLeftButtonDownEvent | Identifies the MouseLeftButtonDown routed event. |
![]() ![]() | MouseLeftButtonUpEvent | Identifies the MouseLeftButtonUp routed event. |
![]() ![]() | OpacityMaskProperty | Identifies the IsHitTestVisible dependency property. |
![]() ![]() | OpacityProperty | Identifies the IsHitTestVisible dependency property. |
![]() ![]() | ProjectionProperty | Identifies the Projection dependency property. |
![]() ![]() | RenderTransformOriginProperty | Identifies the RenderTransformOrigin dependency property. |
![]() ![]() | RenderTransformProperty | Identifies the RenderTransform dependency property. |
![]() ![]() | TapEvent | Identifies the Tap routed event. |
![]() ![]() | TextInputEvent | Identifies the TextInput routed event. |
![]() ![]() | TextInputStartEvent | Identifies the TextInputStart routed event. |
![]() ![]() | TextInputUpdateEvent | Identifies the TextInputUpdate routed event. |
![]() ![]() | UseLayoutRoundingProperty | Identifies the UseLayoutRounding dependency property. |
![]() ![]() | VisibilityProperty | Identifies the Visibility dependency property. |
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:
Specific controls that are not sealed (for example, TextBox)
Control base classes (Control, ContentControl, UserControl)
Panel classes (the base class Panel, or specific non-sealed panel implementations, for example Grid)





