Class TabControl
Represents a control that contains multiple items that share the same space on the screen.
Inheritance
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.Controls.dll
Syntax
[TemplatePart(Name = "TemplateTop", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "TemplateBottom", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "TemplateLeft", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "TemplateRight", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "TabPanelTop", Type = typeof(TabPanel))]
[TemplatePart(Name = "TabPanelBottom", Type = typeof(TabPanel))]
[TemplatePart(Name = "TabPanelLeft", Type = typeof(TabPanel))]
[TemplatePart(Name = "TabPanelRight", Type = typeof(TabPanel))]
[TemplatePart(Name = "ContentTop", Type = typeof(ContentPresenter))]
[TemplatePart(Name = "ContentBottom", Type = typeof(ContentPresenter))]
[TemplatePart(Name = "ContentLeft", Type = typeof(ContentPresenter))]
[TemplatePart(Name = "ContentRight", Type = typeof(ContentPresenter))]
public class TabControl : ItemsControl, IControl, IFrameworkElement, IUIElement, IDependencyObject
Remarks
TabControl allows a developer to arrange visual content in a compacted and organized form. The real-world analog of the control might be a tabbed notebook, in which visual content is displayed in discreet pages which are accessed by selecting the appropriate tab. Each tab/page is encapsulated by a TabItem, the generated item of TabControl. A TabItem has a Header property which corresponds to the content in the tab button and a Content property which corresponds to the content in the tab page. This control is useful for minimizing screen space usage while allowing an application to expose a large amount of data. The user navigates through TabItems by clicking on a tab button using the mouse or by using the keyboard.
Constructors
| Improve this Doc View SourceTabControl()
Initializes a new instance of the TabControl class.
Declaration
public TabControl()
Fields
| Improve this Doc View SourceSelectedContentProperty
Identifies the SelectedContent dependency property.
Declaration
public static readonly DependencyProperty SelectedContentProperty
Field Value
Type | Description |
---|---|
DependencyProperty | The identifier for the SelectedContent dependency property. |
SelectedIndexProperty
Identifies the SelectedIndex dependency property.
Declaration
public static readonly DependencyProperty SelectedIndexProperty
Field Value
Type | Description |
---|---|
DependencyProperty | The identifier for the SelectedIndex dependency property. |
SelectedItemProperty
Identifies the SelectedItem dependency property.
Declaration
public static readonly DependencyProperty SelectedItemProperty
Field Value
Type | Description |
---|---|
DependencyProperty | The identifier for the SelectedItem dependency property. |
TabStripPlacementProperty
Identifies the TabStripPlacement dependency property.
Declaration
public static readonly DependencyProperty TabStripPlacementProperty
Field Value
Type | Description |
---|---|
DependencyProperty | The identifier for the TabStripPlacement dependency property. |
Properties
| Improve this Doc View SourceSelectedContent
Gets the content of the currently selected TabItem.
Declaration
public object SelectedContent { get; }
Property Value
Type | Description |
---|---|
System.Object | The content of the currently selected TabItem. The default is null. |
SelectedIndex
Gets or sets the index of the currently selected TabItem.
Declaration
public int SelectedIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the currently selected TabItem, or -1 if a TabItem is not selected. |
SelectedItem
Gets or sets the currently selected TabItem.
Declaration
public object SelectedItem { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The currently selected TabItem, or null if a TabItem is not selected. |
TabStripPlacement
Declaration
public Dock TabStripPlacement { get; set; }
Property Value
Type | Description |
---|---|
Dock | The alignment of TabItem headers relative to the TabItem content. The default is Top. |
Methods
| Improve this Doc View SourceOnApplyTemplate()
Builds the visual tree for the TabControl when a new template is applied.
Declaration
public override void OnApplyTemplate()
Overrides
| Improve this Doc View SourceOnCreateAutomationPeer()
Returns TabControlAutomationPeer for use by the Silverlight automation infrastructure.
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type | Description |
---|---|
AutomationPeer | A TabControlAutomationPeer for the TabControl object. |
Overrides
| Improve this Doc View SourceOnItemsChanged(NotifyCollectionChangedEventArgs)
Updates the current selection when Items has changed.
Declaration
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Specialized.NotifyCollectionChangedEventArgs | e | Data used by the event. |
Overrides
| Improve this Doc View SourceOnKeyDown(KeyEventArgs)
This is the method that responds to the KeyDown event.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
KeyEventArgs | e | Data used by the event. |
Overrides
| Improve this Doc View SourceOnSelectionChanged(SelectionChangedEventArgs)
Raises the SelectionChanged event.
Declaration
protected virtual void OnSelectionChanged(SelectionChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectionChangedEventArgs | args | Provides data for the SelectionChanged event. |
Events
| Improve this Doc View SourceSelectionChanged
Occurs when the selected TabItem changes.
Declaration
public event SelectionChangedEventHandler SelectionChanged
Event Type
Type | Description |
---|---|
SelectionChangedEventHandler |