Class TabView
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
CanReorderTabsProperty
Identifies the CanReorderTabs dependency property.
public static readonly DependencyProperty CanReorderTabsProperty
Field Value
Properties
CanAddTabs
Gets or sets a value indicating whether the add button is displayed.
public bool CanAddTabs { get; set; }
Property Value
CanReorderTabs
Gets or sets a value indicating whether tabs can be reordered by dragging.
public bool CanReorderTabs { get; set; }
Property Value
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
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
elementDependencyObjectThe item container element.
itemobjectThe 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
itemobjectSpecified item.
Returns
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
eDragEventArgsThe 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
eDragEventArgsThe 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
oldValueIEnumerableOld value of the source.
newValueIEnumerableNew 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
eMouseButtonEventArgsThe 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
eMouseButtonEventArgsThe 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
eMouseEventArgsThe 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
elementDependencyObjectThe element that is used to display the specified item.
itemobjectThe specified item to display.
Events
TabAdding
Occurs before adding a tab. Supply Item for a model ItemsSource.
public event EventHandler<TabViewItemAddingEventArgs>? TabAdding
Event Type
TabClosing
Occurs before the default close operation. Cancel to handle removal yourself.
public event EventHandler<TabViewItemClosingEventArgs>? TabClosing