Table of Contents

Class TabView

Namespace
Wpf.Ui.Controls
Assembly
Wpf.Ui.dll

Displays document tabs that can be added, closed and reordered within this control. Bind model collections using ItemsSource and provide new models through TabAdding.Item. Handlers that perform their own collection updates must set Cancel to true.

[TemplatePart(Name = "PART_AddButton", Type = typeof(Button))]
public class TabView : TabControl, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IContainItemStorage, IAddChild
Inheritance
TabView
Implements
Inherited Members

Constructors

TabView()

Initializes a new instance of the TabView class.

public TabView()

Fields

CanAddTabsProperty

Identifies the CanAddTabs dependency property.

public static readonly DependencyProperty CanAddTabsProperty

Field Value

DependencyProperty

CanReorderTabsProperty

Identifies the CanReorderTabs dependency property.

public static readonly DependencyProperty CanReorderTabsProperty

Field Value

DependencyProperty

Properties

CanAddTabs

Gets or sets a value indicating whether the add button is displayed.

public bool CanAddTabs { get; set; }

Property Value

bool

CanReorderTabs

Gets or sets a value indicating whether tabs can be reordered by dragging.

public bool CanReorderTabs { get; set; }

Property Value

bool

Methods

AddTab(object?, string?)

Requests a new tab. With ItemsSource, supply a compatible Item or TabItem in TabAdding. Unsupported collections are left unchanged. Content and header apply to TabViewItem entries.

public void AddTab(object? content = null, string? header = null)

Parameters

content object
header string

ClearContainerForItemOverride(DependencyObject, object)

Returns an item container to the state it was in before PrepareContainerForItemOverride(DependencyObject, object).

protected override void ClearContainerForItemOverride(DependencyObject element, object item)

Parameters

element DependencyObject

The item container element.

item object

The data item.

GetContainerForItemOverride()

Creates or identifies the element used to display the specified item.

protected override DependencyObject GetContainerForItemOverride()

Returns

DependencyObject

The element used to display the specified item.

IsItemItsOwnContainerOverride(object)

Determines if the specified item is (or is eligible to be) its own ItemContainer.

protected override bool IsItemItsOwnContainerOverride(object item)

Parameters

item object

Specified item.

Returns

bool

Returns true if the item is its own ItemContainer; otherwise, false.

OnApplyTemplate()

Called when ApplyTemplate() is called.

public override void OnApplyTemplate()

OnDragOver(DragEventArgs)

Invoked when an unhandled System.Windows.DragDrop.DragOver attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected override void OnDragOver(DragEventArgs e)

Parameters

e DragEventArgs

The DragEventArgs that contains the event data.

OnDrop(DragEventArgs)

Invoked when an unhandled System.Windows.DragDrop.DragEnter attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected override void OnDrop(DragEventArgs e)

Parameters

e DragEventArgs

The DragEventArgs that contains the event data.

OnItemsSourceChanged(IEnumerable, IEnumerable)

Called when the source of an item in a selector changes.

protected override void OnItemsSourceChanged(IEnumerable oldValue, IEnumerable newValue)

Parameters

oldValue IEnumerable

Old value of the source.

newValue IEnumerable

New value of the source.

OnPreviewMouseLeftButtonDown(MouseButtonEventArgs)

Invoked when an unhandled PreviewMouseLeftButtonDown routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)

Parameters

e MouseButtonEventArgs

The MouseButtonEventArgs that contains the event data. The event data reports that the left mouse button was pressed.

OnPreviewMouseLeftButtonUp(MouseButtonEventArgs)

Invoked when an unhandled PreviewMouseLeftButtonUp routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e)

Parameters

e MouseButtonEventArgs

The MouseButtonEventArgs that contains the event data. The event data reports that the left mouse button was released.

OnPreviewMouseMove(MouseEventArgs)

Invoked when an unhandled System.Windows.Input.Mouse.PreviewMouseMove attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected override void OnPreviewMouseMove(MouseEventArgs e)

Parameters

e MouseEventArgs

The MouseEventArgs that contains the event data.

PrepareContainerForItemOverride(DependencyObject, object)

Prepares the specified element to display the specified item.

protected override void PrepareContainerForItemOverride(DependencyObject element, object item)

Parameters

element DependencyObject

The element that is used to display the specified item.

item object

The specified item to display.

Events

TabAdding

Occurs before adding a tab. Supply Item for a model ItemsSource.

public event EventHandler<TabViewItemAddingEventArgs>? TabAdding

Event Type

EventHandler<TabViewItemAddingEventArgs>

TabClosing

Occurs before the default close operation. Cancel to handle removal yourself.

public event EventHandler<TabViewItemClosingEventArgs>? TabClosing

Event Type

EventHandler<TabViewItemClosingEventArgs>