Element Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides the base class for all Microsoft.Maui.Controls hierarchal elements. This class contains all the methods and properties required to represent an element in the Microsoft.Maui.Controls hierarchy.
public ref class Element abstract : Microsoft::Maui::Controls::BindableObject, Microsoft::Maui::Controls::IEffectControlProvider, Microsoft::Maui::Controls::IElementController, Microsoft::Maui::Controls::Internals::INameScope, Microsoft::Maui::IContextFlyoutElement, Microsoft::Maui::IElement, Microsoft::Maui::IToolTipElement, Microsoft::Maui::IVisualTreeElement
public abstract class Element : Microsoft.Maui.Controls.BindableObject, Microsoft.Maui.Controls.IEffectControlProvider, Microsoft.Maui.Controls.IElementController, Microsoft.Maui.Controls.Internals.INameScope, Microsoft.Maui.IContextFlyoutElement, Microsoft.Maui.IElement, Microsoft.Maui.IToolTipElement, Microsoft.Maui.IVisualTreeElement
type Element = class
inherit BindableObject
interface INameScope
interface IElementController
interface IVisualTreeElement
interface IElement
interface IEffectControlProvider
interface IToolTipElement
interface IContextFlyoutElement
Public MustInherit Class Element
Inherits BindableObject
Implements IContextFlyoutElement, IEffectControlProvider, IElement, IElementController, INameScope, IToolTipElement, IVisualTreeElement
- Inheritance
- Derived
- Implements
Remarks
Important categories of visual elements are noted in the following table:
Class | Description |
---|---|
VisualElement | An Element that occupies an area on the screen, has a visual appearance, and can obtain touch input. |
Cell | Cells are elements meant to be added to ListView or TableView. |
Page | A VisualElement that occupies most or all of the screen and contains a single child. |
Layout | Layout have a single child of type View, while subclasses of Layout have a collection of multiple children views, including other layouts. |
Controls and specialized View | The lower part of the diagram shows the Microsoft.Maui.Controls classes for universally-available controls, such as Button and TableView. |
Constructors
Element() |
Fields
AutomationIdProperty |
Bindable property for AutomationId. |
ClassIdProperty |
Bindable property for ClassId. |
ControlsElementMapper |
Obsolete.
Maps UI information to platform-specific implementations for accessibility services |
Properties
AutomationId |
Gets or sets a value that allows the automation framework to find and interact with this element. |
BindingContext |
Gets or sets an object that contains the properties that will be targeted by the bound properties that belong to this BindableObject. This is a bindable property. (Inherited from BindableObject) |
ClassId |
Gets or sets a value used to identify a collection of semantically similar elements. |
Dispatcher |
Gets the dispatcher that was available when this bindable object was created, otherwise tries to find the nearest available dispatcher (probably the window's/app's). (Inherited from BindableObject) |
EffectControlProvider |
For internal use by .NET MAUI. |
Effects |
Gets or sets the styles and properties that will be applied to the element during runtime. |
Handler |
Gets or sets the associated handler for this element. |
Id |
Gets a value that can be used to uniquely identify an element throughout the run of your application. |
LogicalChildren | |
Parent |
Gets or sets the parent Element of this element. |
RealParent |
For internal use by .NET MAUI. |
StyleId |
Gets or sets a user defined value to uniquely identify the element. |
Methods
AddLogicalChild(Element) |
Adds an Element to the logical children. |
ApplyBindings() |
Applies all the current bindings to BindingContext. (Inherited from BindableObject) |
ClearLogicalChildren() |
Removes all child Elements. |
ClearValue(BindableProperty) |
Clears any value that is previously set for a bindable property. (Inherited from BindableObject) |
ClearValue(BindablePropertyKey) |
Clears any value that is previously set for a bindable property, identified by its key. (Inherited from BindableObject) |
CoerceValue(BindableProperty) |
Coerces the value of the specified bindable property. This is done by invoking BindableProperty.CoerceValueDelegate of the specified bindable property. (Inherited from BindableObject) |
CoerceValue(BindablePropertyKey) |
Coerces the value of the specified bindable property. This is done by invoking BindableProperty.CoerceValueDelegate of the specified bindable property. (Inherited from BindableObject) |
EffectIsAttached(String) |
For internal use by .NET MAUI. |
FindByName(String) |
Returns the element that has the specified name. |
GetValue(BindableProperty) |
Returns the value that is contained in the given bindable property. (Inherited from BindableObject) |
InsertLogicalChild(Int32, Element) |
Inserts an Element to the logical children at the specified index. |
IsSet(BindableProperty) |
Determines whether or not a bindable property exists and has a value set. (Inherited from BindableObject) |
MapAutomationPropertiesExcludedWithChildren(IElementHandler, Element) |
Maps the abstract ExcludedWithChildrenProperty property to the platform-specific implementations. |
MapAutomationPropertiesIsInAccessibleTree(IElementHandler, Element) |
Maps the abstract IsInAccessibleTreeProperty property to the platform-specific implementations. |
OnBindingContextChanged() |
Invoked whenever the binding context of the element changes. Implement this method to add class handling for this event. |
OnChildAdded(Element) |
Raises the ChildAdded event. Implement this method to add class handling for this event. |
OnChildRemoved(Element, Int32) |
Raises the ChildRemoved event. Implement this method to add class handling for this event |
OnHandlerChanged() |
When overridden in a derived class, should raise the HandlerChanged event. |
OnHandlerChanging(HandlerChangingEventArgs) |
When overridden in a derived class, should raise the HandlerChanging event. |
OnParentChanged() |
When overridden in a derived class, should raise the ParentChanged event. |
OnParentChanging(ParentChangingEventArgs) |
When overridden in a derived class, should raise the ParentChanging event. |
OnParentSet() |
Raises the (internal) |
OnPropertyChanged(String) |
Method that is called when a bound property is changed. |
OnPropertyChanging(String) |
Raises the PropertyChanging event. (Inherited from BindableObject) |
RemoveBinding(BindableProperty) |
Removes a previously set binding from a bindable property. (Inherited from BindableObject) |
RemoveDynamicResource(BindableProperty) |
Removes a previously set dynamic resource. |
RemoveLogicalChild(Element) |
Removes the first occurrence of a specific Element from the logical children. |
SetBinding(BindableProperty, BindingBase) |
Assigns a binding to a bindable property. (Inherited from BindableObject) |
SetDynamicResource(BindableProperty, String) |
Sets the BindableProperty property of this element to be updated via the DynamicResource with the provided key. |
SetValue(BindableProperty, Object) |
Sets the value of the specified bindable property. (Inherited from BindableObject) |
SetValue(BindablePropertyKey, Object) |
Sets the value of the specified bindable property. (Inherited from BindableObject) |
SetValueFromRenderer(BindableProperty, Object) |
For internal use by .NET MAUI. |
SetValueFromRenderer(BindablePropertyKey, Object) |
For internal use by .NET MAUI. |
UnapplyBindings() |
Removes all current bindings from the current context. (Inherited from BindableObject) |
Events
BindingContextChanged |
Occurs when the value of the BindingContext property changes. (Inherited from BindableObject) |
ChildAdded |
Raised whenever a child element is added to the element. |
ChildRemoved |
Raised whenever a child element is removed from the element. |
DescendantAdded |
Raised whenever a child element is added to the element's subtree. |
DescendantRemoved |
Raised whenever a child element is removed from the elements subtree. |
HandlerChanged |
Raised whenever the element's handler has changed. |
HandlerChanging |
Raised whenever the element's handler starts to change. |
ParentChanged |
Raised whenever the element's parent has changed. |
ParentChanging |
Raised whenever the element's starts to change. |
PropertyChanged |
Occurs when a property value changes. (Inherited from BindableObject) |
PropertyChanging |
Occurs when a property value is changing. (Inherited from BindableObject) |
Explicit Interface Implementations
IContextFlyoutElement.ContextFlyout |
Gets the ContextFlyout for the view. Menu flyouts, menu flyout subitems, and menu flyout separators can be added to the context flyout. |
IDynamicResourceHandler.SetDynamicResource(BindableProperty, String) | (Inherited from BindableObject) |
IEffectControlProvider.RegisterEffect(Effect) |
Registers the specified |
IElement.Parent |
Gets the Parent of the Element. |
IElementController.Descendants() |
For internal use by .NET MAUI. |
IElementController.LogicalChildren |
For internal use by .NET MAUI. |
IElementController.SetValueFromRenderer(BindableProperty, Object) |
For internal use by .NET MAUI. |
INameScope.RegisterName(String, Object) |
For internal use by .NET MAUI. |
INameScope.UnregisterName(String) |
For internal use by .NET MAUI. |
IToolTipElement.ToolTip |
Represents a small rectangular pop-up window that displays a brief description of a view's purpose when the user rests the pointer on the view. |
IVisualTreeElement.GetVisualChildren() |
Gets a readonly list of the element's visual children. |
IVisualTreeElement.GetVisualParent() |
Gets the element's visual parent. |