Show / Hide Table of Contents

Class UIElement

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

Inheritance
System.Object
DependencyObject
UIElement
TextElement
FrameworkElement
Inherited Members
DependencyObject.GetValue(DependencyProperty)
DependencyObject.SetCurrentValue(DependencyProperty, Object)
DependencyObject.ReadLocalValue(DependencyProperty)
DependencyObject.SetValue(DependencyProperty, Object)
DependencyObject.SetValue(DependencyPropertyKey, Object)
DependencyObject.CoerceValue(DependencyProperty)
DependencyObject.Dispatcher
DependencyObject.INTERNAL_OnAttachedToVisualTree()
DependencyObject.INTERNAL_OnDetachedFromVisualTree()
DependencyObject.ClearValue(DependencyProperty)
DependencyObject.ClearValue(DependencyPropertyKey)
DependencyObject.CheckAccess()
DependencyObject.GetAnimationBaseValue(DependencyProperty)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public abstract class UIElement : DependencyObject, IUIElement, IDependencyObject

Constructors

| Improve this Doc View Source

UIElement()

Declaration
public UIElement()

Fields

| Improve this Doc View Source

AllowDropProperty

Identifies the AllowDrop dependency property.

Declaration
public static readonly DependencyProperty AllowDropProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

AllowScrollOnTouchMoveProperty

Identifies the AllowScrollOnTouchMove dependency property.

Declaration
public static readonly DependencyProperty AllowScrollOnTouchMoveProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

CacheModeProperty

Identifies the CacheMode dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty CacheModeProperty
Field Value
Type Description
DependencyProperty

The identifier for the CacheMode dependency property.

| Improve this Doc View Source

ClipProperty

Identifies the Clip dependency property.

Declaration
public static readonly DependencyProperty ClipProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

ClipToBoundsProperty

Identifies the ClipToBounds dependency property.

Declaration
public static readonly DependencyProperty ClipToBoundsProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

EffectProperty

Identifies the Effect dependency property.

Declaration
public static readonly DependencyProperty EffectProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

GotFocusEvent

Declaration
public static readonly RoutedEvent GotFocusEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

IsEnabledProperty

Identifies the IsEnabled dependency property.

Declaration
public static readonly DependencyProperty IsEnabledProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

IsHitTestVisibleProperty

Identifies the IsHitTestVisible dependency property.

Declaration
public static readonly DependencyProperty IsHitTestVisibleProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

IsVisibleProperty

Identifies the IsVisible dependency property.

Declaration
public static readonly DependencyProperty IsVisibleProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

KeyDownEvent

Declaration
public static readonly RoutedEvent KeyDownEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

KeyUpEvent

Declaration
public static readonly RoutedEvent KeyUpEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

LostFocusEvent

Declaration
public static readonly RoutedEvent LostFocusEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

MouseEnterEvent

Declaration
public static readonly RoutedEvent MouseEnterEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

MouseLeaveEvent

Declaration
public static readonly RoutedEvent MouseLeaveEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

MouseLeftButtonDownEvent

Declaration
public static readonly RoutedEvent MouseLeftButtonDownEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

MouseLeftButtonUpEvent

Declaration
public static readonly RoutedEvent MouseLeftButtonUpEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

MouseMoveEvent

Declaration
public static readonly RoutedEvent MouseMoveEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

MouseRightButtonDownEvent

Identifies the MouseRightButtonDown routed event.

Declaration
public static readonly RoutedEvent MouseRightButtonDownEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

MouseRightButtonUpEvent

Declaration
public static readonly RoutedEvent MouseRightButtonUpEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

MouseWheelEvent

Identifies the MouseWheel routed event.

Declaration
public static readonly RoutedEvent MouseWheelEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

OpacityMaskProperty

Identifies the OpacityMask dependency property.

Declaration
public static readonly DependencyProperty OpacityMaskProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

OpacityProperty

Identifies the Opacity dependency property.

Declaration
public static readonly DependencyProperty OpacityProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

ProjectionProperty

Declaration
[NotImplemented]
public static readonly DependencyProperty ProjectionProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

RenderTransformOriginProperty

Identifies the RenderTransformOrigin dependency property.

Declaration
public static readonly DependencyProperty RenderTransformOriginProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

RenderTransformProperty

Identifies the RenderTransform dependency property.

Declaration
public static readonly DependencyProperty RenderTransformProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

TappedEvent

Declaration
public static readonly RoutedEvent TappedEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

TextInputEvent

Identifies the TextInput routed event.

Declaration
public static readonly RoutedEvent TextInputEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

TextInputStartEvent

Identifies the TextInputStart routed event.

Declaration
public static readonly RoutedEvent TextInputStartEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

TextInputUpdateEvent

Identifies the TextInputUpdate routed event.

Declaration
[NotImplemented]
public static readonly RoutedEvent TextInputUpdateEvent
Field Value
Type Description
RoutedEvent
| Improve this Doc View Source

UseLayoutRoundingProperty

Identifies the UseLayoutRounding dependency property.

Declaration
public static readonly DependencyProperty UseLayoutRoundingProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

VisibilityProperty

Identifies the Visibility dependency property.

Declaration
public static readonly DependencyProperty VisibilityProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

XamlSourcePath

Declaration
public string XamlSourcePath
Field Value
Type Description
System.String

Properties

| Improve this Doc View Source

AllowDrop

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

Declaration
public bool AllowDrop { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

AllowScrollOnTouchMove

Gets or sets whether pressing (touchscreen devices) on this UIElement then moving should allow scrolling or not. The default value is True.

Declaration
public bool AllowScrollOnTouchMove { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

CacheMode

Gets or sets a value that indicates that rendered content should be cached when possible.

Declaration
[NotImplemented]
public CacheMode CacheMode { get; set; }
Property Value
Type Description
CacheMode

A value that indicates that rendered content should be cached when possible. If you specify a value of CacheMode, rendering operations from RenderTransform and Opacity execute on the graphics processing unit (GPU), if available. The default is null, which does not enable a cached composition mode.

| Improve this Doc View Source

Clip

Gets or sets the Geometry used to define the outline of the contents of a UIElement.

Declaration
public Geometry Clip { get; set; }
Property Value
Type Description
Geometry

The geometry to be used for clipping area sizing. The default value is null.

| Improve this Doc View Source

ClipToBounds

Gets or sets a value indicating whether to clip the content of this element (or content coming from the child elements of this element) to fit into the size of the containing element. This is a dependency property.

Declaration
public bool ClipToBounds { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

DesiredSize

Gets the size that this UIElement computed during the measure pass of the layout process.

Declaration
public Size DesiredSize { get; }
Property Value
Type Description
Size

The size that this UIElement computed during the measure pass of the layout process.

| Improve this Doc View Source

Effect

Gets or sets the pixel shader effect to use for rendering this UIElement.

Declaration
public Effect Effect { get; set; }
Property Value
Type Description
Effect

The pixel shader effect to use for rendering this UIElement. The default is null (no effects).

| Improve this Doc View Source

IsEnabled

Gets or sets a value indicating whether the user can interact with the control.

Declaration
public bool IsEnabled { get; set; }
Property Value
Type Description
System.Boolean

true if the user can interact with the control; otherwise, false.

| Improve this Doc View Source

IsHitTestVisible

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

Declaration
public bool IsHitTestVisible { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsMouseCaptured

Gets a value indicating whether the pointer is captured to this element.

Declaration
public bool IsMouseCaptured { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsVisible

Gets a value indicating whether this element is visible in the user interface (UI). This is a dependency property.

Declaration
public bool IsVisible { get; }
Property Value
Type Description
System.Boolean

true if the element is visible; otherwise, false.

| Improve this Doc View Source

Opacity

Gets or sets the degree of the object's opacity.

Declaration
public double Opacity { get; set; }
Property Value
Type Description
System.Double

A value between 0 and 1.0 that declares the opacity factor, with 1.0 meaning full opacity and 0 meaning transparent. The default value is 1.0.

| Improve this Doc View Source

OpacityMask

Gets or sets the brush used to alter the opacity of regions of this object.

Declaration
public Brush OpacityMask { get; set; }
Property Value
Type Description
Brush

A brush that describes the opacity applied to this object. The default is null.

| Improve this Doc View Source

Projection

Declaration
[NotImplemented]
public Projection Projection { get; set; }
Property Value
Type Description
Projection
| Improve this Doc View Source

RenderSize

Gets the final render size of a UIElement.

Declaration
public Size RenderSize { get; }
Property Value
Type Description
Size

The rendered size for this object. There is no default value.

| Improve this Doc View Source

RenderTransform

Gets or sets transform information that affects the rendering position of a UIElement.

Declaration
public Transform RenderTransform { get; set; }
Property Value
Type Description
Transform

Describes the specifics of the desired render transform. The default value is null.

| Improve this Doc View Source

RenderTransformOrigin

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

Declaration
public Point RenderTransformOrigin { get; set; }
Property Value
Type Description
Point

The origin point of the render transform. The default value is a point with value 0,0.

| Improve this Doc View Source

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.

Declaration
public bool UseLayoutRounding { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Visibility

Gets 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.

Declaration
public Visibility Visibility { get; set; }
Property Value
Type Description
Visibility
| Improve this Doc View Source

VisualChildrenCount

Gets the number of child elements for the UIElement.

Declaration
protected virtual int VisualChildrenCount { get; }
Property Value
Type Description
System.Int32

The number of child elements.

| Improve this Doc View Source

VisualParent

Gets the visual tree parent of the visual object.

Declaration
protected DependencyObject VisualParent { get; }
Property Value
Type Description
DependencyObject

The UIElement parent.

Methods

| Improve this Doc View Source

AddHandler(RoutedEvent, Delegate, Boolean)

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.

Declaration
public void AddHandler(RoutedEvent routedEvent, Delegate handler, bool handledEventsToo)
Parameters
Type Name Description
RoutedEvent routedEvent

An identifier for the routed event to be handled.

System.Delegate handler

A reference to the handler implementation.

System.Boolean handledEventsToo

true to register the handler such that it is invoked even when the routed event is marked handled in its event data; false to register the handler with the default condition that it will not be invoked if the routed event is already marked handled. The default is false. Do not routinely ask to rehandle a routed event. For more information, see Remarks.

Exceptions
Type Condition
System.ArgumentNullException

routedEvent or handler is null.

System.ArgumentException

routedEvent does not represent a supported routed event.-or-handler does not implement a supported delegate.

System.NotImplementedException

Attempted to add handler for an event not supported by the current platform variation.

| Improve this Doc View Source

AddVisualChild(UIElement)

Defines the parent-child relationship between two visuals.

Declaration
protected void AddVisualChild(UIElement child)
Parameters
Type Name Description
UIElement child

The child visual object to add to parent visual.

| Improve this Doc View Source

Arrange(Rect)

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.

Declaration
public void Arrange(Rect finalRect)
Parameters
Type Name Description
Rect finalRect

The final size that the parent computes for the child in layout, provided as a Rect value.

Remarks

There is no reason to call Measure(Size) or Arrange(Rect) outside of the context of overriding methods that perform custom layout actions. Silverlight layout works autonomously, based on detecting changes to the object tree and layout-relevant properties at run time. The finalRect you pass to Measure(Size) cannot have a System.Double.NaN value for any Rect value. Also, finalRect cannot have any infinite values for any Rect value. Typically, calls to Arrange(Rect) will incorporate a finalRect that uses the height and width values from DesiredSize for each element . Exceptions to this typical behavior might be necessary if an element holds a DesiredSize that the layout parent cannot accommodate, or if the sum total of all child element DesiredSize values cannot be accommodated or arranged. In such cases the child element content might be clipped, resized, or placed in a scroll region, which all depends on the specific functionality that is enabled in the layout parent container.

Exceptions
Type Condition
System.InvalidOperationException

finalRect contained a System.Double.NaN or infinite value. See Remarks.

| Improve this Doc View Source

CaptureMouse()

Sets pointer capture to a UIElement.

Declaration
public bool CaptureMouse()
Returns
Type Description
System.Boolean

True if the object has pointer capture; otherwise, false.

| Improve this Doc View Source

CreateDomElement(Object, out Object)

When overriden, creates the dom elements designed to represent an instance of an UIElement and defines the place where its child(ren) will be added.

Declaration
public abstract object CreateDomElement(object parentRef, out object domElementWhereToPlaceChildren)
Parameters
Type Name Description
System.Object parentRef

The parent of the UIElement

System.Object domElementWhereToPlaceChildren

The dom element where the UIElement's children will be added.

Returns
Type Description
System.Object

The "root" dom element of the UIElement.

| Improve this Doc View Source

GetVisualChild(Int32)

Returns a child at the specified index from a collection of child elements.

Declaration
protected virtual UIElement GetVisualChild(int index)
Parameters
Type Name Description
System.Int32 index

The zero-based index of the requested child element in the collection.

Returns
Type Description
UIElement

The requested child element. This should not return null; if the provided index is out of range, an exception is thrown.

| Improve this Doc View Source

INTERNAL_AttachToDomEvents()

Declaration
public virtual void INTERNAL_AttachToDomEvents()
| Improve this Doc View Source

INTERNAL_DetachFromDomEvents()

Declaration
public virtual void INTERNAL_DetachFromDomEvents()
| Improve this Doc View Source

InvalidateArrange()

Invalidates the arrange state (layout) for a UIElement. After the invalidation, the UIElement will have its layout updated, which will occur asynchronously.

Declaration
public void InvalidateArrange()
| Improve this Doc View Source

InvalidateMeasure()

Invalidates the measurement state (layout) for a UIElement.

Declaration
public void InvalidateMeasure()
| Improve this Doc View Source

ManageIsEnabled(Boolean)

Declaration
protected virtual void ManageIsEnabled(bool isEnabled)
Parameters
Type Name Description
System.Boolean isEnabled
| Improve this Doc View Source

Measure(Size)

Updates the DesiredSize of a UIElement. Typically, objects that implement custom layout for their layout children call this method from their own MeasureOverride(Size) implementations to form a recursive layout update.

Declaration
public void Measure(Size availableSize)
Parameters
Type Name Description
Size availableSize

The available space that a parent can allocate a child object. A child object can request a larger space than what is available; the provided size might be accommodated if scrolling or other resize behavior is possible in that particular container.

Remarks

There is no reason to call Measure(Size) or Arrange(Rect) outside of the context of overriding methods that perform custom layout actions. Silverlight layout works autonomously, based on detecting changes to the object tree and layout-relevant properties at run time. The availableSize you pass to Measure(Size) cannot have a System.Double.NaN value for either the Height or Width of the Size. availableSize values can be any number from zero to infinite. Elements participating in layout should return the minimum Size they require for a given availableSize.

Exceptions
Type Condition
System.InvalidOperationException

availableSize contained a System.Double.NaN value. See Remarks.

| Improve this Doc View Source

OnCreateAutomationPeer()

When implemented in a derived class, returns class-specific AutomationPeer implementations for the Silverlight automation infrastructure.

Declaration
protected virtual AutomationPeer OnCreateAutomationPeer()
Returns
Type Description
AutomationPeer

The class-specific AutomationPeer subclass to return.

| Improve this Doc View Source

OnGotFocus(RoutedEventArgs)

Raises the GotFocus event

Declaration
protected virtual void OnGotFocus(RoutedEventArgs eventArgs)
Parameters
Type Name Description
RoutedEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnKeyDown(KeyEventArgs)

Raises the KeyDown event

Declaration
protected virtual void OnKeyDown(KeyEventArgs eventArgs)
Parameters
Type Name Description
KeyEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnKeyUp(KeyEventArgs)

Raises the KeyUp event

Declaration
protected virtual void OnKeyUp(KeyEventArgs eventArgs)
Parameters
Type Name Description
KeyEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnLostFocus(RoutedEventArgs)

Raises the LostFocus event

Declaration
protected virtual void OnLostFocus(RoutedEventArgs eventArgs)
Parameters
Type Name Description
RoutedEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnLostMouseCapture(MouseEventArgs)

Called before the LostMouseCapture event occurs to provide handling for the event in a derived class without attaching a delegate.

Declaration
protected virtual void OnLostMouseCapture(MouseEventArgs e)
Parameters
Type Name Description
MouseEventArgs e

A MouseEventArgs that contains the event data.

| Improve this Doc View Source

OnMouseEnter(MouseEventArgs)

Raises the PointerEntered event

Declaration
protected virtual void OnMouseEnter(MouseEventArgs eventArgs)
Parameters
Type Name Description
MouseEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnMouseLeave(MouseEventArgs)

Raises the PointerExited event

Declaration
protected virtual void OnMouseLeave(MouseEventArgs eventArgs)
Parameters
Type Name Description
MouseEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnMouseLeftButtonDown(MouseButtonEventArgs)

Raises the PointerPressed event

Declaration
protected virtual void OnMouseLeftButtonDown(MouseButtonEventArgs eventArgs)
Parameters
Type Name Description
MouseButtonEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnMouseLeftButtonUp(MouseButtonEventArgs)

Raises the PointerReleased event

Declaration
protected virtual void OnMouseLeftButtonUp(MouseButtonEventArgs eventArgs)
Parameters
Type Name Description
MouseButtonEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnMouseMove(MouseEventArgs)

Raises the PointerMoved event

Declaration
protected virtual void OnMouseMove(MouseEventArgs eventArgs)
Parameters
Type Name Description
MouseEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnMouseRightButtonDown(MouseButtonEventArgs)

Raises the MouseRightButtonDown event

Declaration
protected virtual void OnMouseRightButtonDown(MouseButtonEventArgs eventArgs)
Parameters
Type Name Description
MouseButtonEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnMouseRightButtonUp(MouseButtonEventArgs)

Raises the RightTapped event

Declaration
protected virtual void OnMouseRightButtonUp(MouseButtonEventArgs eventArgs)
Parameters
Type Name Description
MouseButtonEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnMouseWheel(MouseWheelEventArgs)

Raises the PointerWheelChanged event

Declaration
protected virtual void OnMouseWheel(MouseWheelEventArgs eventArgs)
Parameters
Type Name Description
MouseWheelEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

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.

Declaration
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type Name Description
DependencyPropertyChangedEventArgs e

Event data that will contain the dependency property identifier of interest, the property metadata for the type, and old and new values.

Overrides
DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs)
| Improve this Doc View Source

OnTapped(TappedRoutedEventArgs)

Raises the Tapped event

Declaration
protected virtual void OnTapped(TappedRoutedEventArgs eventArgs)
Parameters
Type Name Description
TappedRoutedEventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnTextInput(TextCompositionEventArgs)

Called before the TextInput event occurs.

Declaration
protected virtual void OnTextInput(TextCompositionEventArgs eventArgs)
Parameters
Type Name Description
TextCompositionEventArgs eventArgs

A TextCompositionEventArgs that contains the event data.

| Improve this Doc View Source

OnTextInputStart(TextCompositionEventArgs)

Called before the TextInputStart event occurs.

Declaration
protected virtual void OnTextInputStart(TextCompositionEventArgs e)
Parameters
Type Name Description
TextCompositionEventArgs e

A TextCompositionEventArgs that contains the event data.

| Improve this Doc View Source

OnVisualChildrenChanged(DependencyObject, DependencyObject)

Called when the visual element collection of the visual object is modified.

Declaration
protected virtual void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)
Parameters
Type Name Description
DependencyObject visualAdded

The UIElement that was added to the collection.

DependencyObject visualRemoved

The UIElement that was removed from the collection.

| Improve this Doc View Source

OnVisualParentChanged(DependencyObject)

Called when the parent of the visual object is changed.

Declaration
protected virtual void OnVisualParentChanged(DependencyObject oldParent)
Parameters
Type Name Description
DependencyObject oldParent

A value of type DependencyObject that represents the previous parent of the UIElement object. If the UIElement object did not have a previous parent, the value of the parameter is null.

| Improve this Doc View Source

ReleaseMouseCapture()

Releases pointer captures for capture of one specific pointer by this UIElement.

Declaration
public void ReleaseMouseCapture()
| Improve this Doc View Source

RemoveHandler(RoutedEvent, Delegate)

Removes the specified routed event handler from this UIElement.

Declaration
public void RemoveHandler(RoutedEvent routedEvent, Delegate handler)
Parameters
Type Name Description
RoutedEvent routedEvent

The identifier of the routed event for which the handler is attached.

System.Delegate handler

The specific handler implementation to remove from the event handler collection on this UIElement.

Exceptions
Type Condition
System.ArgumentNullException

routedEvent or handler is null.

System.ArgumentException

routedEvent does not represent a supported routed event.-or-handler does not implement a supported delegate.

System.NotImplementedException

Attempted to remove handler for an event not supported by the current platform variation.

| Improve this Doc View Source

RemoveVisualChild(UIElement)

Removes the parent-child relationship between two visuals.

Declaration
protected void RemoveVisualChild(UIElement child)
Parameters
Type Name Description
UIElement child

The child visual object to remove from the parent visual.

| Improve this Doc View Source

TransformToVisual(UIElement)

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

Declaration
public GeneralTransform TransformToVisual(UIElement visual)
Parameters
Type Name Description
UIElement visual

The object to compare to the current object for purposes of obtaining the transform.

Returns
Type Description
GeneralTransform

The transform information as an object. Call methods on this object to get a practical transform.

| Improve this Doc View Source

UpdateLayout()

Ensures that all positions of child objects of a UIElement are properly updated for layout.

Declaration
public void UpdateLayout()

Events

| Improve this Doc View Source

DragEnter

Declaration
[NotImplemented]
public event DragEventHandler DragEnter
Event Type
Type Description
DragEventHandler
| Improve this Doc View Source

DragLeave

Declaration
[NotImplemented]
public event DragEventHandler DragLeave
Event Type
Type Description
DragEventHandler
| Improve this Doc View Source

DragOver

Declaration
[NotImplemented]
public event DragEventHandler DragOver
Event Type
Type Description
DragEventHandler
| Improve this Doc View Source

Drop

Declaration
[NotImplemented]
public event DragEventHandler Drop
Event Type
Type Description
DragEventHandler
| Improve this Doc View Source

GotFocus

Occurs when the pointer device that previously initiated a Press action is pressed, while within this element. Note that ONLY sender's informations are currently filled (not pointer's)

Declaration
public event RoutedEventHandler GotFocus
Event Type
Type Description
RoutedEventHandler
| Improve this Doc View Source

IsEnabledChanged

Occurs when the IsEnabled property changes.

Declaration
public event DependencyPropertyChangedEventHandler IsEnabledChanged
Event Type
Type Description
DependencyPropertyChangedEventHandler
| Improve this Doc View Source

IsVisibleChanged

Occurs when the value of the IsVisible property changes on this element.

Declaration
public event DependencyPropertyChangedEventHandler IsVisibleChanged
Event Type
Type Description
DependencyPropertyChangedEventHandler
| Improve this Doc View Source

KeyDown

Occurs when a keyboard key is pressed while the UIElement has focus.

Declaration
public event KeyEventHandler KeyDown
Event Type
Type Description
KeyEventHandler
| Improve this Doc View Source

KeyUp

Occurs when a keyboard key is released while the UIElement has focus.

Declaration
public event KeyEventHandler KeyUp
Event Type
Type Description
KeyEventHandler
| Improve this Doc View Source

LostFocus

Occurs when a UIElement loses focus.

Declaration
public event RoutedEventHandler LostFocus
Event Type
Type Description
RoutedEventHandler
| Improve this Doc View Source

LostMouseCapture

Declaration
public event MouseEventHandler LostMouseCapture
Event Type
Type Description
MouseEventHandler
| Improve this Doc View Source

MouseEnter

Occurs when a pointer enters the hit test area of this element.

Declaration
public event MouseEventHandler MouseEnter
Event Type
Type Description
MouseEventHandler
| Improve this Doc View Source

MouseLeave

Occurs when a pointer leaves the hit test area of this element.

Declaration
public event MouseEventHandler MouseLeave
Event Type
Type Description
MouseEventHandler
| Improve this Doc View Source

MouseLeftButtonDown

Occurs when the pointer device that previously initiated a Press action is pressed, while within this element.

Declaration
public event MouseButtonEventHandler MouseLeftButtonDown
Event Type
Type Description
MouseButtonEventHandler
| Improve this Doc View Source

MouseLeftButtonUp

Occurs when the pointer device that previously initiated a Press action is released, while within this element.

Declaration
public event MouseButtonEventHandler MouseLeftButtonUp
Event Type
Type Description
MouseButtonEventHandler
| Improve this Doc View Source

MouseMove

Occurs when the pointer device that previously initiated a Press action is moved, while within this element.

Declaration
public event MouseEventHandler MouseMove
Event Type
Type Description
MouseEventHandler
| Improve this Doc View Source

MouseRightButtonDown

Declaration
public event MouseButtonEventHandler MouseRightButtonDown
Event Type
Type Description
MouseButtonEventHandler
| Improve this Doc View Source

MouseRightButtonUp

Occurs when a right-tap input stimulus happens while the pointer is over the element.

Declaration
public event MouseButtonEventHandler MouseRightButtonUp
Event Type
Type Description
MouseButtonEventHandler
| Improve this Doc View Source

MouseWheel

Occurs when the user rotates the mouse wheel while the mouse pointer is over a UIElement, or the UIElement has focus.

Declaration
public event MouseWheelEventHandler MouseWheel
Event Type
Type Description
MouseWheelEventHandler
| Improve this Doc View Source

Tapped

Occurs when an otherwise unhandled Tap interaction occurs over the hit test area of this element.

Declaration
public event TappedEventHandler Tapped
Event Type
Type Description
TappedEventHandler
| Improve this Doc View Source

TextInput

Occurs when a UI element gets text in a device-independent manner.

Declaration
public event TextCompositionEventHandler TextInput
Event Type
Type Description
TextCompositionEventHandler
| Improve this Doc View Source

TextInputStart

Occurs when a UI element initially gets text in a device-independent manner.

Declaration
public event TextCompositionEventHandler TextInputStart
Event Type
Type Description
TextCompositionEventHandler
| Improve this Doc View Source

TextInputUpdate

Occurs when text continues to be composed via an input method editor (IME).

Declaration
[NotImplemented]
public event TextCompositionEventHandler TextInputUpdate
Event Type
Type Description
TextCompositionEventHandler

Extension Methods

DependencyObjectHelper.GetSelfAndAncestors(DependencyObject)
UIElementExtendedRoutedEventExtensions.AddHandler(UIElement, ExtendedRoutedEvent, Delegate, Boolean)
UIElementExtendedRoutedEventExtensions.RemoveHandler(UIElement, ExtendedRoutedEvent, Delegate)
VisualTreeExtensions.GetVisualAncestors(DependencyObject)
VisualTreeExtensions.GetVisualAncestorsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualChildren(DependencyObject)
VisualTreeExtensions.GetVisualChildrenAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualDescendants(DependencyObject)
VisualTreeExtensions.GetVisualDescendantsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualSiblings(DependencyObject)
VisualTreeExtensions.GetVisualSiblingsAndSelf(DependencyObject)
  • Improve this Doc
  • View Source