Class SkinIconElement
- Namespace
- VisioForge.Core.UI.MAUI.Skins
- Assembly
- VisioForge.Core.UI.MAUI.dll
A customizable icon element control that integrates with the VisioForge skinning system for MAUI. This control can display both SVG and PNG images with automatic state management for hover, pressed, and disabled states across all MAUI platforms (Windows, Android, iOS, macCatalyst).
public class SkinIconElement : SKCanvasView, INotifyPropertyChanged, IVisualTreeElement, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IGestureController, IGestureRecognizers, IPropertyMapperView, IHotReloadableView, IReplaceableView, ISKCanvasView, IView, IElement, ITransform, ISKCanvasViewController, IViewController, IVisualElementController, IElementController, IDisposableInheritance
Derived
Implements
Inherited Members
Remarks
The SkinIconElement automatically handles visual states by:
- Loading appropriate graphics from the skin system
- Applying hover effects with color overlays
- Showing pressed states with shadow effects
- Rendering disabled states with transparency overlays
- Scaling graphics to fit the control dimensions
Platform-specific touch/pointer handling is implemented for:
- Windows: Pointer events (PointerPressed)
- Android: Touch events with debouncing
- iOS/macCatalyst: SKTouchEvents
The control integrates with the SkinManager to load graphics and styling information from skin definition files (.vfskin).
Constructors
SkinIconElement()
Initializes a new instance of the VisioForge.Core.UI.MAUI.Skins.SkinIconElement class.
public SkinIconElement()Remarks
The constructor performs the following initialization:
- Sets transparent background for overlay scenarios
- Attaches the paint surface handler for SkiaSharp rendering
- Subscribes to handler lifecycle events for platform-specific setup
- Enables touch event handling
Platform-specific input handlers (pointer, touch) are configured when the control is added to the visual tree via the HandlerChanged event.
Graphics are not loaded until a skin is assigned via the VisioForge.Core.UI.MAUI.Skins.SkinIconElement.SkinName property.
Fields
ElementStateProperty
Dependency property for the ElementState property. Determines the current visual state of the control.
public static readonly BindableProperty ElementStatePropertyField Value
ElementTypeProperty
Dependency property for the ElementType property. Determines what type of skin element this control represents.
public static readonly BindableProperty ElementTypePropertyField Value
SkinNameProperty
Dependency property for the SkinName property. Determines which skin to load for this control.
public static readonly BindableProperty SkinNamePropertyField Value
Properties
ElementState
Gets or sets the state of the element.
public SkinElementState ElementState { get; set; }Property Value
- SkinElementState
Remarks
The element state affects the visual appearance through:
- Base: Normal appearance
- Hover: Highlighted appearance (with optional color overlay)
- Pressed: Pressed appearance (with shadow effect)
- Disabled: Grayed out appearance (with transparency overlay)
ElementType
Gets or sets the type of skin element this control represents.
public SkinElementType ElementType { get; set; }Property Value
- SkinElementType
Remarks
Changing this property will trigger a reload of the appropriate graphics from the current skin and update the control's visual appearance.
SkinName
Gets or sets the name of the skin to use for this control.
public string SkinName { get; set; }Property Value
Remarks
The skin name must match a skin that has been loaded via SkinManager.LoadFromData or SkinManager.LoadFromFile. Changing the skin name will reload all graphics and styling from the new skin definition.
Methods
Dispose()
Releases all resources used by the VisioForge.Core.UI.MAUI.Skins.SkinIconElement.
public void Dispose()Remarks
This method performs complete cleanup of managed and unmanaged resources:
- Unsubscribes from all platform-specific event handlers
- Disposes bitmap resources (_png)
- Releases SVG resources (_svg)
- Unsubscribes from all MAUI events
Call this method when the control is no longer needed to prevent memory leaks, especially important for long-running applications that dynamically create and destroy controls.
The method is safe to call multiple times.
Dispose(bool)
Disposes managed and unmanaged resources. Properly unsubscribes from platform-specific event handlers to prevent memory leaks.
protected virtual void Dispose(bool disposing)Parameters
disposingbool-
True if disposing managed resources.
OnClickOrTouch
Occurs when the user clicks or touches the control.
public event EventHandler OnClickOrTouchEvent Type
Remarks
This event provides a unified click/touch interface across all platforms:
- Windows: Fires on pointer press (mouse or touch)
- Android: Fires on touch with 500ms debouncing to prevent double-triggers
- iOS/macCatalyst: Fires on touch release via SKTouch events
The event does not provide coordinates or button information - it simply indicates that the control was activated by user interaction.
Platform-specific event handlers are automatically attached and cleaned up via the HandlerChanged and HandlerChanging events.