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
UIElement
Inherited Members
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()
Assembly: OpenSilver.dll
Syntax
public abstract class UIElement : DependencyObject
Constructors
|
Improve this Doc
View Source
UIElement()
Declaration
Fields
|
Improve this Doc
View Source
AllowDropProperty
Identifies the AllowDrop dependency
property.
Declaration
public static readonly DependencyProperty AllowDropProperty
Field Value
|
Improve this Doc
View Source
Declaration
public static readonly DependencyProperty AllowScrollOnTouchMoveProperty
Field Value
|
Improve this Doc
View Source
CacheModeProperty
Identifies the CacheMode dependency property.
Declaration
[NotImplemented]
public static readonly DependencyProperty CacheModeProperty
Field Value
|
Improve this Doc
View Source
ClipProperty
Declaration
public static readonly DependencyProperty ClipProperty
Field Value
|
Improve this Doc
View Source
ClipToBoundsProperty
Declaration
public static readonly DependencyProperty ClipToBoundsProperty
Field Value
|
Improve this Doc
View Source
EffectProperty
Identifies the Effect dependency
property.
Declaration
public static readonly DependencyProperty EffectProperty
Field Value
|
Improve this Doc
View Source
GotFocusEvent
Declaration
public static readonly RoutedEvent GotFocusEvent
Field Value
|
Improve this Doc
View Source
IsHitTestVisibleProperty
Declaration
public static readonly DependencyProperty IsHitTestVisibleProperty
Field Value
|
Improve this Doc
View Source
KeyDownEvent
Declaration
public static readonly RoutedEvent KeyDownEvent
Field Value
|
Improve this Doc
View Source
KeyUpEvent
Declaration
public static readonly RoutedEvent KeyUpEvent
Field Value
|
Improve this Doc
View Source
LostFocusEvent
Declaration
public static readonly RoutedEvent LostFocusEvent
Field Value
|
Improve this Doc
View Source
MouseEnterEvent
Declaration
public static readonly RoutedEvent MouseEnterEvent
Field Value
|
Improve this Doc
View Source
MouseLeaveEvent
Declaration
public static readonly RoutedEvent MouseLeaveEvent
Field Value
|
Improve this Doc
View Source
Declaration
public static readonly RoutedEvent MouseLeftButtonDownEvent
Field Value
|
Improve this Doc
View Source
Declaration
public static readonly RoutedEvent MouseLeftButtonUpEvent
Field Value
|
Improve this Doc
View Source
MouseMoveEvent
Declaration
public static readonly RoutedEvent MouseMoveEvent
Field Value
|
Improve this Doc
View Source
Declaration
public static readonly RoutedEvent MouseRightButtonDownEvent
Field Value
|
Improve this Doc
View Source
Declaration
public static readonly RoutedEvent MouseRightButtonUpEvent
Field Value
|
Improve this Doc
View Source
MouseWheelEvent
Declaration
public static readonly RoutedEvent MouseWheelEvent
Field Value
|
Improve this Doc
View Source
OpacityMaskProperty
Identifies the OpacityMask dependency property.
Declaration
[NotImplemented]
public static readonly DependencyProperty OpacityMaskProperty
Field Value
|
Improve this Doc
View Source
OpacityProperty
Identifies the Opacity dependency
property.
Declaration
public static readonly DependencyProperty OpacityProperty
Field Value
|
Improve this Doc
View Source
ProjectionProperty
Declaration
[NotImplemented]
public static readonly DependencyProperty ProjectionProperty
Field Value
|
Improve this Doc
View Source
Declaration
public static readonly DependencyProperty RenderTransformOriginProperty
Field Value
|
Improve this Doc
View Source
Declaration
public static readonly DependencyProperty RenderTransformProperty
Field Value
|
Improve this Doc
View Source
TappedEvent
Declaration
public static readonly RoutedEvent TappedEvent
Field Value
|
Improve this Doc
View Source
TextInputEvent
Declaration
public static readonly RoutedEvent TextInputEvent
Field Value
|
Improve this Doc
View Source
TextInputStartEvent
Declaration
[NotImplemented]
public static readonly RoutedEvent TextInputStartEvent
Field Value
|
Improve this Doc
View Source
TextInputUpdateEvent
Declaration
[NotImplemented]
public static readonly RoutedEvent TextInputUpdateEvent
Field Value
|
Improve this Doc
View Source
UseLayoutRoundingProperty
Declaration
public static readonly DependencyProperty UseLayoutRoundingProperty
Field Value
|
Improve this Doc
View Source
VisibilityProperty
Declaration
public static readonly DependencyProperty VisibilityProperty
Field Value
|
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
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
Declaration
public Geometry Clip { get; set; }
Property Value
|
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
Declaration
public Size DesiredSize { get; }
Property Value
|
Improve this Doc
View Source
Effect
Declaration
public Effect Effect { get; set; }
Property Value
|
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
A property indicating if this element is visible or not.
Declaration
public bool IsVisible { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Opacity
Gets or sets the degree of the object's opacity.
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.
Declaration
public double Opacity { get; set; }
Property Value
Type |
Description |
System.Double |
|
|
Improve this Doc
View Source
OpacityMask
Gets or sets the brush used to alter the opacity of
regions of this object.
Declaration
[NotImplemented]
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
|
Improve this Doc
View Source
RenderSize
Declaration
public Size RenderSize { get; }
Property Value
|
Improve this Doc
View Source
Gets or sets transform information that affects the rendering position of
a UIElement.
Declaration
public Transform RenderTransform { get; set; }
Property Value
|
Improve this Doc
View Source
Declaration
public Point RenderTransformOrigin { get; set; }
Property Value
|
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
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
Arrange(Rect)
Declaration
public void Arrange(Rect finalRect)
Parameters
Type |
Name |
Description |
Rect |
finalRect |
|
|
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
CreateDomChildWrapper(Object, out Object, Int32)
When overriden, creates a dom wrapper for each child that is added to the UIElement.
Declaration
public virtual object CreateDomChildWrapper(object parentRef, out object domElementWhereToPlaceChild, int index = -1)
Parameters
Type |
Name |
Description |
System.Object |
parentRef |
|
System.Object |
domElementWhereToPlaceChild |
|
System.Int32 |
index |
The index for the position in which to add the child.
|
Returns
Type |
Description |
System.Object |
|
|
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
GetChildsWrapper(UIElement)
Declaration
public object GetChildsWrapper(UIElement child)
Parameters
Returns
Type |
Description |
System.Object |
|
|
Improve this Doc
View Source
GetDomElementWhereToPlaceChild(UIElement)
Declaration
public virtual object GetDomElementWhereToPlaceChild(UIElement child)
Parameters
Returns
Type |
Description |
System.Object |
|
|
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
INTERNAL_OnDetachedFromVisualTree()
Declaration
protected override void INTERNAL_OnDetachedFromVisualTree()
Overrides
|
Improve this Doc
View Source
InvalidateArrange()
Declaration
public void InvalidateArrange()
|
Improve this Doc
View Source
InvalidateMeasure()
Declaration
public void InvalidateMeasure()
|
Improve this Doc
View Source
Measure(Size)
Declaration
public void Measure(Size availableSize)
Parameters
Type |
Name |
Description |
Size |
availableSize |
|
|
Improve this Doc
View Source
OnCreateAutomationPeer()
Declaration
[NotImplemented]
protected virtual AutomationPeer OnCreateAutomationPeer()
Returns
|
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
Declaration
protected virtual void OnKeyDown(KeyEventArgs eventArgs)
Parameters
Type |
Name |
Description |
KeyEventArgs |
eventArgs |
The arguments for the event.
|
|
Improve this Doc
View Source
Declaration
protected virtual void OnKeyUp(KeyEventArgs eventArgs)
Parameters
Type |
Name |
Description |
KeyEventArgs |
eventArgs |
The arguments for the event.
|
|
Improve this Doc
View Source
OnLayoutUpdated()
Declaration
protected virtual void OnLayoutUpdated()
|
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
Declaration
protected virtual void OnLostMouseCapture(MouseEventArgs e)
Parameters
|
Improve this Doc
View Source
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
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
Raises the PointerPressed event
Declaration
protected virtual void OnMouseLeftButtonDown(MouseButtonEventArgs eventArgs)
Parameters
|
Improve this Doc
View Source
Raises the PointerReleased event
Declaration
protected virtual void OnMouseLeftButtonUp(MouseButtonEventArgs eventArgs)
Parameters
|
Improve this Doc
View Source
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
Raises the MouseRightButtonDown event
Declaration
protected virtual void OnMouseRightButtonDown(MouseButtonEventArgs eventArgs)
Parameters
|
Improve this Doc
View Source
Raises the RightTapped event
Declaration
protected virtual void OnMouseRightButtonUp(MouseButtonEventArgs eventArgs)
Parameters
|
Improve this Doc
View Source
Raises the PointerWheelChanged event
Declaration
protected virtual void OnMouseWheel(MouseWheelEventArgs eventArgs)
Parameters
|
Improve this Doc
View Source
Declaration
protected virtual void OnTapped(TappedRoutedEventArgs eventArgs)
Parameters
|
Improve this Doc
View Source
OnTextInput(TextCompositionEventArgs)
Raises the TextInput event
Declaration
protected virtual void OnTextInput(TextCompositionEventArgs eventArgs)
Parameters
|
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
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()
Declaration
public void UpdateLayout()
Events
|
Improve this Doc
View Source
DragEnter
Declaration
[NotImplemented]
public event DragEventHandler DragEnter
Event Type
|
Improve this Doc
View Source
DragLeave
Declaration
[NotImplemented]
public event DragEventHandler DragLeave
Event Type
|
Improve this Doc
View Source
DragOver
Declaration
[NotImplemented]
public event DragEventHandler DragOver
Event Type
|
Improve this Doc
View Source
Drop
Declaration
[NotImplemented]
public event DragEventHandler Drop
Event Type
|
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
|
Improve this Doc
View Source
IsVisibleChanged
Declaration
public event DependencyPropertyChangedEventHandler IsVisibleChanged
Event Type
|
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
|
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
|
Improve this Doc
View Source
LostFocus
Occurs when a UIElement loses focus.
Declaration
public event RoutedEventHandler LostFocus
Event Type
|
Improve this Doc
View Source
LostMouseCapture
Declaration
public event MouseEventHandler LostMouseCapture
Event Type
|
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
|
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
|
Improve this Doc
View Source
Occurs when the pointer device that previously initiated a Press action is
pressed, while within this element.
Declaration
public event MouseButtonEventHandler MouseLeftButtonDown
Event Type
|
Improve this Doc
View Source
Occurs when the pointer device that previously initiated a Press action is
released, while within this element.
Declaration
public event MouseButtonEventHandler MouseLeftButtonUp
Event Type
|
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
|
Improve this Doc
View Source
Declaration
public event MouseButtonEventHandler MouseRightButtonDown
Event Type
|
Improve this Doc
View Source
Occurs when a right-tap input stimulus happens while the pointer is over
the element.
Declaration
public event MouseButtonEventHandler MouseRightButtonUp
Event Type
|
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
|
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
|
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
|
Improve this Doc
View Source
TextInputStart
Occurs when a UI element initially gets text in a device-independent manner.
Declaration
[NotImplemented]
public event TextCompositionEventHandler TextInputStart
Event Type
|
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
Extension Methods