TabView TabView TabView Class

Definition

The TabView control is a way to display a set of tabs and their respective content. Tab controls are useful for displaying several pages (or documents) of content while giving a user the capability to rearrange, open, or close new tabs.

Is this the right control?

Use a TabView to help the user manage multiple app pages or documents within the same window.

Do not use a TabView to display a static set of tabs that the user cannot rearrange, open, or close. Use a Pivot or top NavigationView instead.

class TabView : Control
public class TabView : Control
Public Class TabView
Inherits Control
Inheritance
TabViewTabViewTabView
Attributes

Examples

Basic TabView Sample, similar to a Web Browser

<TabView AddTabButtonClick="Tabs_AddTabButtonClick"
         TabCloseRequested="Tabs_TabCloseRequested" />
// Add a new Tab to the TabView
private void Tabs_AddTabButtonClick(TabView sender, TabViewAddTabButtonClickEventArgs e)
{
    var newTab = new TabViewItem();
    newTab.IconSource = new SymbolIconSource() { Symbol = Symbol.Document };
    newTab.Header = "New Document";

    // The Content of a TabViewItem is often a frame which hosts a page.
    Frame frame = new Frame();
    newTab.Content = frame;
    frame.Navigate(typeof(BaconIpsumPage));

    sender.TabItems.Add(newTab);
}

// Remove the requested tab from the TabView
private void Tabs_TabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs args)
{
    sender.TabItems.Remove(args.Tab);
}

Constructors

TabView() TabView() TabView()

Initializes a new instance of the TabView class.

Properties

AddTabButtonCommand AddTabButtonCommand AddTabButtonCommand

Gets or sets the command to invoke when the add (+) button is tapped.

AddTabButtonCommandParameter AddTabButtonCommandParameter AddTabButtonCommandParameter

Gets or sets the parameter to pass to the AddTabButtonCommand property.

AddTabButtonCommandParameterProperty AddTabButtonCommandParameterProperty AddTabButtonCommandParameterProperty

Identifies the AddTabButtonCommandParameter dependency property.

AddTabButtonCommandProperty AddTabButtonCommandProperty AddTabButtonCommandProperty

Identifies the AddButtonCommand dependency property.

AllowDropTabs AllowDropTabs AllowDropTabs

Gets or sets a value that determines whether the TabView can be a drop target for the purposes of drag-and-drop operations.

AllowDropTabsProperty AllowDropTabsProperty AllowDropTabsProperty

Identifies the AllowDropTabs dependency property.

CanDragTabs CanDragTabs CanDragTabs

Gets or sets a value that indicates whether tabs can be dragged as a data payload.

CanDragTabsProperty CanDragTabsProperty CanDragTabsProperty

Identifies the CanDragTabs dependency property.

CanReorderTabs CanReorderTabs CanReorderTabs

Gets or sets a value that indicates whether the tabs in the TabStrip can be reordered through user interaction.

CanReorderTabsProperty CanReorderTabsProperty CanReorderTabsProperty

Identifies the CanReorderTabs dependency property.

Identifies the CanReorderTabs dependency property.

IsAddTabButtonVisible IsAddTabButtonVisible IsAddTabButtonVisible

Gets or sets whether the add (+) tab button is visible.

IsAddTabButtonVisibleProperty IsAddTabButtonVisibleProperty IsAddTabButtonVisibleProperty

Identifies the IsAddTabButtonVisible dependency property.

SelectedIndex SelectedIndex SelectedIndex

Gets or sets the index of the selected item.

SelectedIndexProperty SelectedIndexProperty SelectedIndexProperty

Identifies the SelectedIndex dependency property.

SelectedItem SelectedItem SelectedItem

Gets or sets the selected item.

SelectedItemProperty SelectedItemProperty SelectedItemProperty

Identifies the SelectedItem dependency property.

TabItems TabItems TabItems

Gets the collection used to generate the tabs within the control.

TabItemsProperty TabItemsProperty TabItemsProperty

Identifies the TabItems dependency property.

TabItemsSource TabItemsSource TabItemsSource

Gets or sets an object source used to generate the tabs within the TabView.

TabItemsSourceProperty TabItemsSourceProperty TabItemsSourceProperty

Identifies the TabItemsSource dependency property.

TabItemTemplate TabItemTemplate TabItemTemplate

Gets or sets the DataTemplate used to display each item.

TabItemTemplateProperty TabItemTemplateProperty TabItemTemplateProperty

Identifies the TabItemTemplate dependency property.

TabItemTemplateSelector TabItemTemplateSelector TabItemTemplateSelector

Gets or sets a selection object that changes the DataTemplate to apply for content, based on processing information about the content item or its container at run time.

TabItemTemplateSelectorProperty TabItemTemplateSelectorProperty TabItemTemplateSelectorProperty

Identifies the TabItemTemplateSelector dependency property.

TabStripFooter TabStripFooter TabStripFooter

Gets or sets the content that is shown to the right of the tab strip.

TabStripFooterProperty TabStripFooterProperty TabStripFooterProperty

Identifies the TabStripFooter dependency property.

TabStripFooterTemplate TabStripFooterTemplate TabStripFooterTemplate

Gets or sets the DataTemplate used to display the content of the TabStripFooter.

TabStripFooterTemplateProperty TabStripFooterTemplateProperty TabStripFooterTemplateProperty

Identifies the TabStripFooterTemplate dependency property.

TabStripHeader TabStripHeader TabStripHeader

Gets or sets the content that is shown to the left of the tab strip.

TabStripHeaderProperty TabStripHeaderProperty TabStripHeaderProperty

Identifies the TabStripHeader dependency property.

TabStripHeaderTemplate TabStripHeaderTemplate TabStripHeaderTemplate

Gets or sets the DataTemplate used to display the content of the TabStripHeader.

TabStripHeaderTemplateProperty TabStripHeaderTemplateProperty TabStripHeaderTemplateProperty

Identifies the TabStripHeaderTemplate dependency property.

TabWidthMode TabWidthMode TabWidthMode

Gets or sets how the tabs should be sized.

TabWidthModeProperty TabWidthModeProperty TabWidthModeProperty

Identifies the TabWidthMode dependency property.

Methods

ContainerFromIndex(Int32) ContainerFromIndex(Int32) ContainerFromIndex(Int32)

Returns the container for the item at the specified index within the collection.

ContainerFromItem(Object) ContainerFromItem(Object) ContainerFromItem(Object)

Returns the container corresponding to the specified item.

Events

AddTabButtonClick AddTabButtonClick AddTabButtonClick

Occurs when the add (+) tab button has been clicked.

SelectionChanged SelectionChanged SelectionChanged

Occurs when the currently selected tab changes.

TabCloseRequested TabCloseRequested TabCloseRequested

Raised when the user attempts to close a Tab via clicking the x-to-close button, CTRL+F4, or mousewheel.

TabDragCompleted TabDragCompleted TabDragCompleted

Raised when the user completes the drag action.

TabDragStarting TabDragStarting TabDragStarting

Occurs when a drag operation is initiated.

TabDroppedOutside TabDroppedOutside TabDroppedOutside

Occurs when the user completes a drag and drop operation by dropping a tab outside of the TabStrip area.

TabItemsChanged TabItemsChanged TabItemsChanged

Raised when the items collection has changed.

TabStripDragOver TabStripDragOver TabStripDragOver

Occurs when the input system reports an underlying drag event with the TabStrip as the potential drop target.

TabStripDrop TabStripDrop TabStripDrop

Occurs when the input system reports an underlying drop event with the TabStrip as the drop target.

Applies to