Table of Contents

Class SkinElementData

Namespace
VisioForge.Core.UI.Skins
Assembly
VisioForge.Core.dll

Contains visual state data for a single UI element within a skin, supporting multiple states (base, hover, pressed, disabled).

public class SkinElementData

Inheritance

Inherited Members

Remarks

Each UI element can have up to four visual states, each represented by separate image data:

  • VisioForge.Core.UI.Skins.SkinElementData.Base - The default appearance when not interacting
  • VisioForge.Core.UI.Skins.SkinElementData.Hover - Appearance when mouse cursor is over the element
  • VisioForge.Core.UI.Skins.SkinElementData.Pressed - Appearance during active click or touch
  • VisioForge.Core.UI.Skins.SkinElementData.Disabled - Appearance when the element is not available
Not all states are required; if a state is not defined (null), the control should fall back to the base state or apply alternative visual feedback. The VisioForge.Core.UI.Skins.SkinElementData.IsSVG property indicates whether the images are vector (SVG) or raster (PNG, etc.), which affects rendering and scaling behavior.

Constructors

SkinElementData(bool)

Initializes a new instance of the VisioForge.Core.UI.Skins.SkinElementData class with the specified image format.

public SkinElementData(bool svg)

Parameters

svg bool

if set to true, indicates that the element images are in SVG format; otherwise, they are raster images.

Remarks

The image format should be consistent across all states (base, hover, pressed, disabled) for a single element. Mixing SVG and raster formats within a single element is not supported.

Properties

Base

Gets or sets the image data for the element's default/normal state.

public byte[] Base { get; set; }

Property Value

byte[]

Remarks

This is the required state for any UI element. If no other states are defined, this image will be used for all visual states. The format (SVG or PNG) is indicated by VisioForge.Core.UI.Skins.SkinElementData.IsSVG.

Disabled

Gets or sets the image data displayed when the element is in a disabled state.

public byte[] Disabled { get; set; }

Property Value

byte[]

Remarks

This state indicates that the element is not currently available or applicable. If not defined, controls may render the base image with reduced opacity or grayscale effect.

Hover

Gets or sets the image data displayed when the mouse hovers over the element.

public byte[] Hover { get; set; }

Property Value

byte[]

Remarks

This state provides visual feedback as the user moves the cursor over interactive elements. If not defined, controls may use VisioForge.Core.UI.Skins.Skin.ButtonHoverColor for hover feedback or show no hover effect.

IsSVG

Gets a value indicating whether the element images are in SVG format.

public bool IsSVG { get; }

Property Value

bool

Remarks

SVG images provide resolution-independent scaling and are preferred for high-DPI displays. Raster images (PNG) may be used for complex graphics or when SVG rendering is not available. This property is set during construction and cannot be changed, as it affects how the image data is interpreted.

Pressed

Gets or sets the image data displayed when the element is pressed (mouse down or touch active).

public byte[] Pressed { get; set; }

Property Value

byte[]

Remarks

This state provides visual feedback during active user interaction. If not defined, controls may fall back to the base image or apply alternative visual effects.

Methods

GetByState(SkinElementState)

Retrieves the appropriate image data based on the specified element state.

public byte[] GetByState(SkinElementState state)

Parameters

state SkinElementState

The visual state of the element to retrieve image data for.

Returns

byte[]

The byte array containing the image data for the specified state. If the requested state is not available (null), returns the VisioForge.Core.UI.Skins.SkinElementData.Base image as a fallback.

Remarks

This method ensures that a valid image is always returned by falling back to the base state when specific state images are not defined. This allows partial skin definitions where only the most important states are provided.