Represents a base object that has a user interface and implements IUIElement.
- Inheritance:
-
object
Marshal
By DisposableRef Object Object LogicalTree objectNode Base
- Derived:
-
Bar
Command DockableLink Tool DockableBar Tool StatusBar Row Bar AutoPanel Hide AutoTab Hide DockTab Group Container TabTitle Bar Button Strip TabButton Strip MarkupTab Label NavigationUIElement Bar NavigationOverflow Menu Button Pane CanvasButton Control ScrollBar ScrollButton Bar CollapsedThumb Region EditorAdornment View EditorHost View EditorMargin Base View EditorSelection Gripper View PrinterSplitter View ScrollMargin Base Bar ScrollBlock Bar TextSplitter View UIElementComponent WizardButton WizardContainer Interior Page Header
Constructors
UIElement()
Initializes a new instance of the UIElement
class.
Remarks
The default constructor initializes all fields to their default values.
Properties
ActualHeight
Gets the actual height of the element.
Property Value
- int:
The actual height of the element.
Remarks
This is determined by the layout system after Arrange(Rectangle) has completed.
This is only valid if Istrue
.
ActualWidth
Gets the actual width of the element.
Property Value
- int:
The actual width of the element.
Remarks
This is determined by the layout system after Arrange(Rectangle) has completed.
This is only valid if Istrue
.
Bounds
Gets a Rectangle specifying the bounds of the element.
CaptureMouseWhenPressed
Indicates whether to automatically capture the mouse when the element is pressed.
Property Value
- bool:
true
if the mouse should automatically be captured when the element is pressed; otherwise,false
.
ClipBounds
Gets a Rectangle specifying the clip bounds when drawing the element.
DesiredSize
Gets the desired size of the element as computed by Measure(Graphics, Size).
Property Value
- Size:
The desired size of the element as computed by Measure(Graphics, Size).
Remarks
This is only valid if Istrue
.
DpiScaleFactor
Gets the current DPI-based scale factor to be applied when rendering the element, where Width is applied to the x-axis, and Height is applied to the y-axis.
Property Value
See Also
InvalidateOnMouseEvents
Gets whether to invalidate the element when mouse events occur.
Property Value
- bool:
true
if the element should be invalidated when mouse events occur.
IsArrangeValid
Gets whether the value of the Desired
Property Value
- bool:
true
if the value of the DesiredSize property and position of child elements is valid; otherwise,false
.
Remarks
A developer can force arrangement to be invalidated by calling Invalidate
IsMeasureValid
Gets whether the value of the Desired
Property Value
- bool:
true
if the value of the DesiredSize property is valid; otherwise,false
.
Remarks
A developer can force arrangement to be invalidated by calling Invalidate
IsMouseCaptured
Gets whether the element is currently capturing the mouse.
Property Value
- bool:
true
if the element is currently capturing the mouse; otherwise,false
.
IsRightToLeft
Gets whether the element is using a right-to-left layout.
Property Value
- bool:
true
if the element is using a right-to-left layout; otherwise,false
.
Size
Gets the actual size of the element.
Property Value
- Size:
The actual size of the element.
Remarks
This is determined by the layout system after Arrange(Rectangle) has completed.
This is only valid if Istrue
.
VisualOffset
Gets the X/Y offset of the element relative to its parent element's coordinate system.
Property Value
- Point:
The X/Y offset of the element relative to its parent element's coordinate system.
Remarks
This is determined by the layout system after Arrange(Rectangle) has completed.
This is only valid if Istrue
.
Methods
AddPendingGraphicsInversion(Rectangle)
Inverts the canvas using XOR at the end of the current or next drawing operation.
Parameter | Type | Description |
---|---|---|
bounds | Rectangle | A |
Returns
- bool:
true
if the inversion operation was added successfully; otherwise,false
.
AddPendingScrollOperation(Rectangle, int, int)
Scrolls the canvas the specified amount at the beginning of the next drawing operation.
Parameter | Type | Description |
---|---|---|
bounds | Rectangle | The bounds to scroll. |
xAmount | int | The amount to scroll horizontally. |
yAmount | int | The amount to scroll vertically. |
Returns
- bool:
true
if the scroll operation was added successfully; otherwise,false
.
AddPendingScrollOperation(Rectangle, Orientation, int)
Scrolls the canvas the specified amount at the beginning of the next drawing operation.
Parameter | Type | Description |
---|---|---|
bounds | Rectangle | The bounds to scroll. |
orientation | Orientation | The direction to scroll. |
amount | int | The amount to scroll. |
Returns
- bool:
true
if the scroll operation was added successfully; otherwise,false
.
Arrange(Rectangle)
Positions child elements and determines a size for the IUIElement.
Parameter | Type | Description |
---|---|---|
finalRect | Rectangle | The final bounds of the element, relative to its parent. |
Remarks
Override the Arrange
ArrangeOverride(Size)
Positions child elements and determines an arrange size.
Parameter | Type | Description |
---|---|---|
finalSize | Size | The final area within the parent that this element should use to arrange itself and its children. |
Returns
- Size:
The actual size used.
Remarks
Element authors should override this method, call Arrange(Rectangle) on each visible child element and position each child element. It is required that a parent element calls Arrange(Rectangle) on each child or they won't be rendered.
CaptureMouse()
Attaches the mouse capture to the element.
ContainsLocation(Point)
Used with hit-testing, returning whether this element's bounds contains the specified location.
Parameter | Type | Description |
---|---|---|
location | Point | The Point location to examine. |
Returns
- bool:
true
if this element's bounds contains the specified location; otherwise,false
.
Remarks
Override this method to prevent certain portions of the element's bounds from being included in hit-testing.
CreateGraphics()
Creates the Graphics object for the use with the object.
Dispose(bool)
Disposes any resources used by the object.
Parameter | Type | Description |
---|---|---|
disposing | bool | Whether the object is being disposed. |
DpiScaleChanged(SizeF)
Called when the DPI-based scale factor of the element changes.
Parameter | Type | Description |
---|---|---|
scaleFactor | Size |
The new scale factor where Width is applied to the x-axis, and Height is applied to the y-axis. |
See Also
GetCursor(Point)
Invalidate()
Invalidates the area of the object and causes it to be repainted.
Invalidate(InvalidationLevels, InvalidationTypes)
Invalidates the specified states for the element or its related elements.
Parameter | Type | Description |
---|---|---|
levels | Invalidation |
The hierarchy levels at which to invalidate. |
types | Invalidation |
The types of invalidation to perform. |
Invalidate(Rectangle)
Invalidates an area in the object and causes it to be repainted.
Parameter | Type | Description |
---|---|---|
rect | Rectangle | The bounds of the rectangle to invalidate. |
InvalidateArrange()
Invalidates the layout of the element.
InvalidateMeasure()
Invalidates the measurement of the element.
Measure(Graphics, Size)
Measures the element and updates the Desired
Parameter | Type | Description |
---|---|---|
g | Graphics | The Graphics object to use for measurement. |
availableSize | Size | The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available. |
Remarks
Override the Measure
MeasureOverride(Graphics, Size)
Measures the size in layout required for child elements and determines a size for the element itself.
Parameter | Type | Description |
---|---|---|
g | Graphics | The Graphics object to use for measurement. |
availableSize | Size | The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available. |
Returns
- Size:
The size that this element determines it needs during layout, based on its calculations of child element sizes.
Remarks
Element authors should override this method, call Measure(Graphics, Size) on each visible child element and determine the total size required.
OnClick(MouseEventArgs)
Raises the Click event.
Parameter | Type | Description |
---|---|---|
e | Mouse |
A |
OnDoubleClick(MouseEventArgs)
Raises the Double
Parameter | Type | Description |
---|---|---|
e | Mouse |
A |
OnMouseCaptureLost(EventArgs)
Raises the Mouse
Parameter | Type | Description |
---|---|---|
e | Event |
The |
OnMouseDown(MouseEventArgs)
Raises the Mouse
Parameter | Type | Description |
---|---|---|
e | Mouse |
A |
OnMouseEnter(MouseEventArgs)
Raises the Mouse
Parameter | Type | Description |
---|---|---|
e | Mouse |
A |
OnMouseHover(MouseEventArgs)
Raises the Mouse
Parameter | Type | Description |
---|---|---|
e | Mouse |
A |
OnMouseLeave(MouseEventArgs)
Raises the Mouse
Parameter | Type | Description |
---|---|---|
e | Mouse |
A |
OnMouseMove(MouseEventArgs)
Raises the Mouse
Parameter | Type | Description |
---|---|---|
e | Mouse |
A |
OnMouseUp(MouseEventArgs)
Raises the Mouse
Parameter | Type | Description |
---|---|---|
e | Mouse |
A |
OnMouseWheel(MouseEventArgs)
Raises the Mouse
Parameter | Type | Description |
---|---|---|
e | Mouse |
A |
OnParentChanged()
Invoked when logical parent is changed. This is invoked after the parent has changed, and the purpose is to allow elements to perform actions based on the changed parent.
OnRender(PaintEventArgs)
Renders the element.
Parameter | Type | Description |
---|---|---|
e | Paint |
A Paint |
OnRenderChildElements(PaintEventArgs)
Renders the child elements.
Parameter | Type | Description |
---|---|---|
e | Paint |
A Paint |
Remarks
This method should not generally be overridden.
The default implementation of this method calls the Render(Paint
OnResize(EventArgs)
Raises the Resize event.
Parameter | Type | Description |
---|---|---|
e | Event |
An |
PostArrangeOverride()
Allows custom logic to be executed following a successful call to the Arrange
ReleaseMouseCapture()
Releases the mouse capture, if any.
Render(PaintEventArgs)
Renders the element.
Parameter | Type | Description |
---|---|---|
e | Paint |
A Paint |
TransformToAncestor(IUIElement)
Returns a General
Parameter | Type | Description |
---|---|---|
ancestor | IUIElement | The ancestor IUIElement. |
Returns
- General
Transform : A General
Transform from this element to a ancestor element.
TransformToDescendant(IUIElement)
Returns a General
Parameter | Type | Description |
---|---|---|
descendant | IUIElement | The descendant IUIElement. |
Returns
- General
Transform : A General
Transform from this element to a descendant element.
UpdateLayout()
Call this method to ensure that the whole subtree of elements that includes this UIElement is properly updated.
Remarks
This ensures that UIElement objects with invalid measure or arrange states will get a call to their Measure(Graphics, Size) and Arrange(Rectangle) methods, and all computed sizes will be validated. This method does nothing if layout is clean but it does work if layout is not clean so avoid calling it after each change in the element tree. It makes sense to either never call it (system will do this in a deferred manner) or only call it if you absolutely need updated sizes and positions after you do all changes.
Events
Click
Occurs when the object is clicked.
Event Type
DoubleClick
Occurs when the object is double-clicked.
Event Type
MouseCaptureLost
Occurs when the mouse loses capture.
Event Type
MouseDown
Occurs when the mouse pointer is over the object and a mouse button is pressed.
Event Type
MouseEnter
Occurs when the mouse pointer enters the object.
Event Type
MouseHover
Occurs when the mouse pointer hovers over the object.
Event Type
MouseLeave
Occurs when the mouse pointer leaves the object.
Event Type
MouseMove
Occurs when the mouse pointer is moved over the object.
Event Type
MouseUp
Occurs when the mouse pointer is over the object and a mouse button is released.
Event Type
MouseWheel
Occurs when the mouse wheel moves while the object has focus.
Event Type
Resize
Occurs when the object is resized.
Event Type
Fields
logger
For internal use only.
Inherited Members
-
Logical
Tree Node Base. Create Children() -
Disposable
Object. Dispose() -
Disposable
Object. Verify Not Disposed() -
Disposable
Object. Is Disposed -
Disposable
Object. Disposed -
Marshal
By Ref Object. Get Lifetime Service() -
Marshal
By Ref Object. Initialize Lifetime Service() -
Marshal
By Ref Object. Memberwise Clone(bool) -
object.
Get Type() -
object.
Memberwise Clone() -
object.
To String() -
object.
Equals(object) -
object.
Equals(object, object) -
object.
Reference Equals(object, object) -
object.
Get Hash Code()
Extension Methods
-
Dpi
Aware Element Extensions. Auto Scale Font(IDpi Aware Element, Font) -
Dpi
Aware Element Extensions. Auto Scale Font Size(IDpi Aware Element, float) -
Dpi
Aware Element Extensions. Scale Logical Value(IDpi Aware Element, Padding) -
Dpi
Aware Element Extensions. Scale Logical Value(IDpi Aware Element, Point) -
Dpi
Aware Element Extensions. Scale Logical Value(IDpi Aware Element, Rectangle) -
Dpi
Aware Element Extensions. Scale Logical Value(IDpi Aware Element, Size) -
Dpi
Aware Element Extensions. Scale Logical Value(IDpi Aware Element, Size F) -
Dpi
Aware Element Extensions. Scale Logical Value(IDpi Aware Element, int) -
Dpi
Aware Element Extensions. Scale Logical Value(IDpi Aware Element, float) -
Dpi
Aware Element Extensions. Scale Logical Value(IDpi Aware Element, Padding) -
Dpi
Aware Element Extensions. Synchronize Scale Factor With Children(IDpi Aware Element)