Table of Contents

Class TabItem

Namespace
Myra.Graphics2D.UI
Assembly
Myra.dll

Represents a single tab item in a tab control, containing text, an optional image, and associated content.

public class TabItem : BaseObject, IItemWithId, INotifyAttachedPropertyChanged, ISelectorItem, IContent
Inheritance
TabItem
Implements
Inherited Members

Constructors

TabItem()

Initializes a new instance of the TabItem class with default values.

public TabItem()

TabItem(string, Widget)

Initializes a new instance of the TabItem class with text and content.

public TabItem(string text, Widget content)

Parameters

text string

The text to display on the tab.

content Widget

The widget to display as the tab's content when selected.

TabItem(string, Color?, object, Widget)

Initializes a new instance of the TabItem class with specified properties.

public TabItem(string text, Color? color = null, object tag = null, Widget content = null)

Parameters

text string

The text to display on the tab.

color Color?

The color of the tab text, or null to use the style default.

tag object

An optional object to associate with the tab item.

content Widget

The widget to display as the tab's content when selected.

Properties

Color

Gets or sets the color of the tab text, or null to use the style default.

public Color? Color { get; set; }

Property Value

Color?

Content

Gets or sets the widget to display as the tab's content when selected.

[Browsable(false)]
public Widget Content { get; set; }

Property Value

Widget

Height

Gets or sets the height of the tab in pixels, or null to use the style default.

public int? Height { get; set; }

Property Value

int?

Image

Gets or sets an optional image displayed alongside the tab text.

[Browsable(false)]
public IImage Image { get; set; }

Property Value

IImage

ImageTextSpacing

Gets or sets the spacing in pixels between the image and text in the tab.

[Browsable(false)]
public int ImageTextSpacing { get; set; }

Property Value

int

IsSelected

Gets or sets a value indicating whether this tab item is currently selected.

[Browsable(false)]
public bool IsSelected { get; set; }

Property Value

bool

Tag

Gets or sets an optional tag object associated with this tab item.

[Browsable(false)]
public object Tag { get; set; }

Property Value

object

Text

Gets or sets the text displayed on the tab.

public string Text { get; set; }

Property Value

string

Methods

Clone()

Creates a deep copy of this tab item, including a clone of its content widget if present.

public TabItem Clone()

Returns

TabItem

A new TabItem instance with copies of all properties and content.

FireChanged()

Raises the Changed event to notify listeners of property changes.

protected void FireChanged()

OnIdChanged()

Called when the Id property of this tab item changes. Raises the Changed event.

protected override void OnIdChanged()

ToString()

Returns a string representation of the tab item, including its text and id if available.

public override string ToString()

Returns

string

A string containing the tab's text and id in the format "Text (#id)".

Events

Changed

Occurs when any property of the tab item changes.

public event MyraEventHandler Changed

Event Type

MyraEventHandler

SelectedChanged

Occurs when the tab's selected state changes.

public event MyraEventHandler SelectedChanged

Event Type

MyraEventHandler