Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

UIElement Class

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

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

public abstract class UIElement : DependencyObject

The UIElement type exposes the following members.

  NameDescription
Public propertySupported by Silverlight for Windows PhoneAllowDropGets or sets a value that determines whether this UIElement can be a drop target for purposes of Silverlight drag-and-drop operations.
Public propertySupported by Silverlight for Windows PhoneCacheModeGets or sets a value that indicates that rendered content should be cached when possible.
Public propertySupported by Silverlight for Windows PhoneClipGets or sets the Geometry used to define the outline of the contents of a UIElement.
Public propertySupported by Silverlight for Windows PhoneDesiredSizeGets the size that this UIElement computed during the measure pass of the layout process.
Public propertySupported by Silverlight for Windows PhoneDispatcherGets the Dispatcher this object is associated with. (Inherited from DependencyObject.)
Public propertyEffectGets or sets the pixel shader effect to use for rendering this UIElement.
Public propertySupported by Silverlight for Windows PhoneIsHitTestVisibleGets or sets whether the contained area of this UIElement can return true values for hit testing.
Public propertySupported by Silverlight for Windows PhoneOpacityGets or sets the degree of the object's opacity.
Public propertySupported by Silverlight for Windows PhoneOpacityMaskGets or sets the brush used to alter the opacity of regions of this object.
Public propertySupported by Silverlight for Windows PhoneProjectionGets or sets the perspective projection (3-D effect) to apply when rendering this UIElement.
Public propertySupported by Silverlight for Windows PhoneRenderSizeGets the final render size of a UIElement.
Public propertySupported by Silverlight for Windows PhoneRenderTransformGets or sets transform information that affects the rendering position of a UIElement.
Public propertySupported by Silverlight for Windows PhoneRenderTransformOriginGets or sets the origin point of any possible render transform declared by RenderTransform, relative to the bounds of the UIElement.
Public propertySupported by Silverlight for Windows PhoneUseLayoutRoundingGets 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 propertySupported by Silverlight for Windows PhoneVisibilityGets 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 methodSupported by Silverlight for Windows PhoneAddHandlerAdds 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 methodSupported by Silverlight for Windows PhoneArrangePositions 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 methodSupported by Silverlight for Windows PhoneCaptureMouseSets mouse capture to a UIElement.
Public methodSupported by Silverlight for Windows PhoneCheckAccessDetermines whether the calling thread has access to this object. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneClearValueClears the local value of a dependency property. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetAnimationBaseValueReturns any base value established for a Silverlight dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetValueReturns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneInvalidateArrangeInvalidates the arrange state (layout) for a UIElement. After the invalidation, the UIElement will have its layout updated, which will occur asynchronously.
Public methodSupported by Silverlight for Windows PhoneInvalidateMeasureInvalidates the measurement state (layout) for a UIElement.
Public methodSupported by Silverlight for Windows PhoneMeasureUpdates 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 methodSupported by Silverlight for Windows PhoneMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneOnCreateAutomationPeerWhen implemented in a derived class, returns class-specific AutomationPeer implementations for the Silverlight automation infrastructure.
Public methodSupported by Silverlight for Windows PhoneReadLocalValueReturns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneReleaseMouseCaptureRemoves mouse capture from a UIElement. After this call, typically no object holds mouse capture.
Public methodSupported by Silverlight for Windows PhoneRemoveHandlerRemoves the specified routed event handler from this UIElement.
Public methodSupported by Silverlight for Windows PhoneSetValueSets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneTransformToVisualReturns a transform object that can be used to transform coordinates from the UIElement to the specified object.
Public methodSupported by Silverlight for Windows PhoneUpdateLayoutEnsures that all positions of child objects of a UIElement are properly updated for layout.
Top

  NameDescription
Public eventSupported by Silverlight for Windows PhoneDoubleTapOccurs when a DoubleTap gesture is committed while over this UIElement.
Public eventDragEnterOccurs when the input system reports an underlying drag event with this element as the target.
Public eventDragLeaveOccurs when the input system reports an underlying drag event with this element as the origin.
Public eventDragOverOccurs when the input system reports an underlying drag event with this element as the potential drop target.
Public eventDropOccurs when the input system reports an underlying drop event with this element as the drop target.
Public eventSupported by Silverlight for Windows PhoneGotFocusOccurs when a UIElement receives focus.
Public eventSupported by Silverlight for Windows PhoneHoldOccurs when a Hold gesture is committed while over this UIElement.
Public eventSupported by Silverlight for Windows PhoneKeyDownOccurs when a keyboard key is pressed while the UIElement has focus.
Public eventSupported by Silverlight for Windows PhoneKeyUpOccurs when a keyboard key is released while the UIElement has focus.
Public eventSupported by Silverlight for Windows PhoneLostFocusOccurs when a UIElement loses focus.
Public eventSupported by Silverlight for Windows PhoneLostMouseCaptureOccurs when the UIElement loses mouse capture.
Public eventSupported by Silverlight for Windows PhoneManipulationCompletedOccurs when a manipulation and inertia on the UIElement is complete.
Public eventSupported by Silverlight for Windows PhoneManipulationDeltaOccurs when the input device changes position during a manipulation.
Public eventSupported by Silverlight for Windows PhoneManipulationStartedOccurs when an input device begins a manipulation on the UIElement.
Public eventMediaCommandOccurs when a button is pressed on a remote control.
Public eventSupported by Silverlight for Windows PhoneMouseEnterOccurs when the mouse (or a stylus) enters the bounding area of a UIElement.
Public eventSupported by Silverlight for Windows PhoneMouseLeaveOccurs when the mouse (or the stylus) leaves the bounding area of a UIElement.
Public eventSupported by Silverlight for Windows PhoneMouseLeftButtonDownOccurs when the left mouse button is pressed (or when the tip of the stylus touches the tablet) while the mouse pointer is over a UIElement.
Public eventSupported by Silverlight for Windows PhoneMouseLeftButtonUpOccurs when the left mouse button is released (or the tip of the stylus is removed from the tablet) while the mouse (or the stylus) is over a UIElement (or while a UIElement holds mouse capture).
Public eventSupported by Silverlight for Windows PhoneMouseMoveOccurs when the coordinate position of the mouse (or stylus) changes while over a UIElement (or while a UIElement holds mouse capture).
Public eventMouseRightButtonDownOccurs when the right mouse button is pressed while the mouse pointer is over a UIElement.
Public eventMouseRightButtonUpOccurs when the right mouse button is released while the mouse pointer is over a UIElement. However, this event will only be raised if a caller marks the preceding MouseRightButtonDown event as handled; see Remarks.
Public eventSupported by Silverlight for Windows PhoneMouseWheelOccurs when the user rotates the mouse wheel while the mouse pointer is over a UIElement, or the UIElement has focus.
Public eventSupported by Silverlight for Windows PhoneTapOccurs when a Tap gesture is committed while over this UIElement.
Public eventSupported by Silverlight for Windows PhoneTextInputOccurs when a UI element gets text in a device-independent manner.
Public eventSupported by Silverlight for Windows PhoneTextInputStartOccurs when a UI element initially gets text in a device-independent manner.
Public eventSupported by Silverlight for Windows PhoneTextInputUpdateOccurs when text continues to be composed via an input method editor (IME).
Top

  NameDescription
Public fieldStatic memberSupported by Silverlight for Windows PhoneAllowDropPropertyIdentifies the AllowDrop dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneCacheModePropertyIdentifies the CacheMode dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneClipPropertyIdentifies the Clip dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneDoubleTapEventIdentifies the DoubleTap routed event.
Public fieldStatic memberEffectPropertyIdentifies the Effect dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneHoldEventIdentifies the Hold routed event.
Public fieldStatic memberSupported by Silverlight for Windows PhoneIsHitTestVisiblePropertyIdentifies the IsHitTestVisible dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneKeyDownEventIdentifies the KeyDown routed event.
Public fieldStatic memberSupported by Silverlight for Windows PhoneKeyUpEventIdentifies the KeyUp routed event.
Public fieldStatic memberSupported by Silverlight for Windows PhoneManipulationCompletedEventIdentifies the ManipulationCompleted routed event.
Public fieldStatic memberSupported by Silverlight for Windows PhoneManipulationDeltaEventIdentifies the ManipulationDelta routed event.
Public fieldStatic memberSupported by Silverlight for Windows PhoneManipulationStartedEventIdentifies the ManipulationStarted routed event.
Public fieldStatic memberSupported by Silverlight for Windows PhoneMouseLeftButtonDownEventIdentifies the MouseLeftButtonDown routed event.
Public fieldStatic memberSupported by Silverlight for Windows PhoneMouseLeftButtonUpEventIdentifies the MouseLeftButtonUp routed event.
Public fieldStatic memberMouseRightButtonDownEventIdentifies the MouseRightButtonDown routed event.
Public fieldStatic memberMouseRightButtonUpEventIdentifies the MouseRightButtonUp routed event.
Public fieldStatic memberMouseWheelEventIdentifies the MouseWheel routed event.
Public fieldStatic memberSupported by Silverlight for Windows PhoneOpacityMaskPropertyIdentifies the IsHitTestVisible dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneOpacityPropertyIdentifies the IsHitTestVisible dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneProjectionPropertyIdentifies the Projection dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneRenderTransformOriginPropertyIdentifies the RenderTransformOrigin dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneRenderTransformPropertyIdentifies the RenderTransform dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneTapEventIdentifies the Tap routed event.
Public fieldStatic memberSupported by Silverlight for Windows PhoneTextInputEventIdentifies the TextInput routed event.
Public fieldStatic memberSupported by Silverlight for Windows PhoneTextInputStartEventIdentifies the TextInputStart routed event.
Public fieldStatic memberSupported by Silverlight for Windows PhoneTextInputUpdateEventIdentifies the TextInputUpdate routed event.
Public fieldStatic memberSupported by Silverlight for Windows PhoneUseLayoutRoundingPropertyIdentifies the UseLayoutRounding dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneVisibilityPropertyIdentifies the Visibility dependency property.
Top

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

Much of the input behavior for visible elements in a Silverlight UI is defined in the UIElement class. This includes the events for keyboard, mouse and stylus 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 Silverlight 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 in Silverlight are these classes:

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft