Show / Hide Table of Contents

Class TabControl

Represents a control that contains multiple items that share the same space on the screen.

Inheritance
System.Object
DependencyObject
UIElement
FrameworkElement
Control
ItemsControl
TabControl
Inherited Members
ItemsControl.Items
ItemsControl.ItemContainerGenerator
ItemsControl.ItemsPanel
ItemsControl.ItemsPanelProperty
ItemsControl.ItemsSource
ItemsControl.ItemsSourceProperty
ItemsControl.ItemTemplate
ItemsControl.ItemTemplateProperty
ItemsControl.DisplayMemberPath
ItemsControl.DisplayMemberPathProperty
ItemsControl.ItemContainerStyle
ItemsControl.ItemContainerStyleProperty
ItemsControl.UpdateItemsPanel(ItemsPanelTemplate)
ItemsControl.OnItemsSourceChanged(IEnumerable, IEnumerable)
ItemsControl.LogicalChildren
ItemsControl.ClearContainerForItemOverride(DependencyObject, Object)
ItemsControl.GetContainerForItemOverride()
ItemsControl.IsItemItsOwnContainerOverride(Object)
ItemsControl.PrepareContainerForItemOverride(DependencyObject, Object)
ItemsControl.GetItemsOwner(DependencyObject)
ItemsControl.ItemsControlFromItemContainer(DependencyObject)
ItemsControl.OnTextInput(TextCompositionEventArgs)
Control.EnableBaseControlHandlingOfVisualStates
Control.ManageIsEnabled(Boolean)
Control.Background
Control.BackgroundProperty
Control.BorderBrush
Control.BorderBrushProperty
Control.BorderThickness
Control.BorderThicknessProperty
Control.FontWeight
Control.FontWeightProperty
Control.FontStyle
Control.FontStyleProperty
Control.Foreground
Control.ForegroundProperty
Control.FontFamily
Control.FontFamilyProperty
Control.FontSize
Control.FontSizeProperty
Control.TextDecorations
Control.TextDecorationsProperty
Control.Padding
Control.PaddingProperty
Control.HorizontalContentAlignment
Control.HorizontalContentAlignmentProperty
Control.VerticalContentAlignment
Control.VerticalContentAlignmentProperty
Control.TabIndex
Control.TabIndexProperty
Control.IsTabStop
Control.IsTabStopProperty
Control.TabNavigation
Control.TabNavigationProperty
Control.Template
Control.TemplateProperty
Control.ApplyTemplate()
Control.GetTemplateChild(String)
Control.Focus()
Control.HandlesScrolling
Control.OnGotFocus(RoutedEventArgs)
Control.OnLostFocus(RoutedEventArgs)
Control.CreateDomElement(Object, Object)
Control.CharacterSpacingProperty
Control.CharacterSpacing
Control.FontStretchProperty
Control.FontStretch
Control.OnDrop(DragEventArgs)
Control.OnDragEnter(DragEventArgs)
Control.OnDragLeave(DragEventArgs)
Control.OnTextInputUpdate(TextCompositionEventArgs)
Control.MeasureOverride(Size)
Control.ArrangeOverride(Size)
FrameworkElement.LayoutUpdated
FrameworkElement.SizeChanged
FrameworkElement.ResourceLookupMode
FrameworkElement.StyleProperty
FrameworkElement.Style
FrameworkElement.DefaultStyleKeyProperty
FrameworkElement.DefaultStyleKey
FrameworkElement.OverridesDefaultStyleProperty
FrameworkElement.OverridesDefaultStyle
FrameworkElement.OnVisualParentChanged(DependencyObject)
FrameworkElement.VisualChildrenCount
FrameworkElement.GetVisualChild(Int32)
FrameworkElement.Parent
FrameworkElement.AddLogicalChild(Object)
FrameworkElement.RemoveLogicalChild(Object)
FrameworkElement.TemplatedParent
FrameworkElement.Resources
FrameworkElement.IsLoaded
FrameworkElement.SetBinding(DependencyProperty, BindingBase)
FrameworkElement.SetBinding(DependencyProperty, Binding)
FrameworkElement.GetBindingExpression(DependencyProperty)
FrameworkElement.Cursor
FrameworkElement.CursorProperty
FrameworkElement.FindName(String)
FrameworkElement.Name
FrameworkElement.NameProperty
FrameworkElement.DataContext
FrameworkElement.DataContextProperty
FrameworkElement.DataContextChanged
FrameworkElement.Triggers
FrameworkElement.FlowDirectionProperty
FrameworkElement.FlowDirection
FrameworkElement.LanguageProperty
FrameworkElement.Language
FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs)
FrameworkElement.Tag
FrameworkElement.TagProperty
FrameworkElement.LoadedEvent
FrameworkElement.Loaded
FrameworkElement.Unloaded
FrameworkElement.BindingValidationError
FrameworkElement.ContextMenuProperty
FrameworkElement.ContextMenu
FrameworkElement.ContextMenuOpening
FrameworkElement.ToolTipProperty
FrameworkElement.ToolTip
FrameworkElement.INTERNAL_OnDetachedFromVisualTree()
FrameworkElement.INTERNAL_OnAttachedToVisualTree()
FrameworkElement.Height
FrameworkElement.HeightProperty
FrameworkElement.Width
FrameworkElement.WidthProperty
FrameworkElement.HorizontalAlignment
FrameworkElement.HorizontalAlignmentProperty
FrameworkElement.VerticalAlignment
FrameworkElement.VerticalAlignmentProperty
FrameworkElement.Margin
FrameworkElement.MarginProperty
FrameworkElement.MinHeight
FrameworkElement.MinHeightProperty
FrameworkElement.MinWidth
FrameworkElement.MinWidthProperty
FrameworkElement.MaxHeight
FrameworkElement.MaxHeightProperty
FrameworkElement.MaxWidth
FrameworkElement.MaxWidthProperty
FrameworkElement.ActualWidthProperty
FrameworkElement.ActualWidth
FrameworkElement.ActualHeightProperty
FrameworkElement.ActualHeight
UIElement.TransformToVisual(UIElement)
UIElement.RenderSize
UIElement.DesiredSize
UIElement.InvalidateMeasure()
UIElement.InvalidateArrange()
UIElement.Measure(Size)
UIElement.Arrange(Rect)
UIElement.UpdateLayout()
UIElement.DragEnter
UIElement.DragLeave
UIElement.Drop
UIElement.DragOver
UIElement.CacheMode
UIElement.CacheModeProperty
UIElement.Projection
UIElement.ProjectionProperty
UIElement.VisualParent
UIElement.AddVisualChild(UIElement)
UIElement.RemoveVisualChild(UIElement)
UIElement.OnVisualChildrenChanged(DependencyObject, DependencyObject)
UIElement.XamlSourcePath
UIElement.ClipToBounds
UIElement.ClipToBoundsProperty
UIElement.ClipProperty
UIElement.Clip
UIElement.IsEnabledProperty
UIElement.IsEnabled
UIElement.IsEnabledChanged
UIElement.EffectProperty
UIElement.Effect
UIElement.RenderTransformProperty
UIElement.RenderTransform
UIElement.RenderTransformOriginProperty
UIElement.RenderTransformOrigin
UIElement.UseLayoutRounding
UIElement.UseLayoutRoundingProperty
UIElement.Visibility
UIElement.VisibilityProperty
UIElement.IsVisibleProperty
UIElement.IsVisible
UIElement.IsVisibleChanged
UIElement.OpacityProperty
UIElement.Opacity
UIElement.OpacityMaskProperty
UIElement.OpacityMask
UIElement.IsHitTestVisible
UIElement.IsHitTestVisibleProperty
UIElement.AllowDrop
UIElement.AllowDropProperty
UIElement.CaptureMouse()
UIElement.IsMouseCaptured
UIElement.ReleaseMouseCapture()
UIElement.AllowScrollOnTouchMove
UIElement.AllowScrollOnTouchMoveProperty
UIElement.AddHandler(RoutedEvent, Delegate, Boolean)
UIElement.RemoveHandler(RoutedEvent, Delegate)
UIElement.MouseMoveEvent
UIElement.MouseMove
UIElement.OnMouseMove(MouseEventArgs)
UIElement.MouseLeftButtonDownEvent
UIElement.MouseLeftButtonDown
UIElement.OnMouseLeftButtonDown(MouseButtonEventArgs)
UIElement.MouseRightButtonDownEvent
UIElement.MouseRightButtonDown
UIElement.OnMouseRightButtonDown(MouseButtonEventArgs)
UIElement.MouseWheelEvent
UIElement.MouseWheel
UIElement.OnMouseWheel(MouseWheelEventArgs)
UIElement.MouseLeftButtonUpEvent
UIElement.MouseLeftButtonUp
UIElement.OnMouseLeftButtonUp(MouseButtonEventArgs)
UIElement.MouseEnterEvent
UIElement.MouseEnter
UIElement.OnMouseEnter(MouseEventArgs)
UIElement.MouseLeaveEvent
UIElement.MouseLeave
UIElement.OnMouseLeave(MouseEventArgs)
UIElement.TextInputStartEvent
UIElement.TextInputStart
UIElement.OnTextInputStart(TextCompositionEventArgs)
UIElement.TextInputEvent
UIElement.TextInput
UIElement.TextInputUpdateEvent
UIElement.TextInputUpdate
UIElement.TappedEvent
UIElement.Tapped
UIElement.OnTapped(TappedRoutedEventArgs)
UIElement.MouseRightButtonUpEvent
UIElement.MouseRightButtonUp
UIElement.OnMouseRightButtonUp(MouseButtonEventArgs)
UIElement.KeyDownEvent
UIElement.KeyDown
UIElement.KeyUpEvent
UIElement.KeyUp
UIElement.OnKeyUp(KeyEventArgs)
UIElement.GotFocusEvent
UIElement.GotFocus
UIElement.LostFocusEvent
UIElement.LostFocus
UIElement.LostMouseCapture
UIElement.OnLostMouseCapture(MouseEventArgs)
UIElement.INTERNAL_AttachToDomEvents()
UIElement.INTERNAL_DetachFromDomEvents()
DependencyObject.GetValue(DependencyProperty)
DependencyObject.SetCurrentValue(DependencyProperty, Object)
DependencyObject.ReadLocalValue(DependencyProperty)
DependencyObject.SetValue(DependencyProperty, Object)
DependencyObject.SetValue(DependencyPropertyKey, Object)
DependencyObject.CoerceValue(DependencyProperty)
DependencyObject.Dispatcher
DependencyObject.ClearValue(DependencyProperty)
DependencyObject.ClearValue(DependencyPropertyKey)
DependencyObject.CheckAccess()
DependencyObject.GetAnimationBaseValue(DependencyProperty)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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 Source

TabControl()

Initializes a new instance of the TabControl class.

Declaration
public TabControl()

Fields

| Improve this Doc View Source

SelectedContentProperty

Identifies the SelectedContent dependency property.

Declaration
public static readonly DependencyProperty SelectedContentProperty
Field Value
Type Description
DependencyProperty

The identifier for the SelectedContent dependency property.

| Improve this Doc View Source

SelectedIndexProperty

Identifies the SelectedIndex dependency property.

Declaration
public static readonly DependencyProperty SelectedIndexProperty
Field Value
Type Description
DependencyProperty

The identifier for the SelectedIndex dependency property.

| Improve this Doc View Source

SelectedItemProperty

Identifies the SelectedItem dependency property.

Declaration
public static readonly DependencyProperty SelectedItemProperty
Field Value
Type Description
DependencyProperty

The identifier for the SelectedItem dependency property.

| Improve this Doc View Source

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 Source

SelectedContent

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

TabStripPlacement

Gets or sets how TabItem headers align relative to the TabItem content.

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 Source

OnApplyTemplate()

Builds the visual tree for the TabControl when a new template is applied.

Declaration
public override void OnApplyTemplate()
Overrides
Control.OnApplyTemplate()
| Improve this Doc View Source

OnCreateAutomationPeer()

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
UIElement.OnCreateAutomationPeer()
| Improve this Doc View Source

OnItemsChanged(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
ItemsControl.OnItemsChanged(NotifyCollectionChangedEventArgs)
| Improve this Doc View Source

OnKeyDown(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
UIElement.OnKeyDown(KeyEventArgs)
| Improve this Doc View Source

OnSelectionChanged(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 Source

SelectionChanged

Occurs when the selected TabItem changes.

Declaration
public event SelectionChangedEventHandler SelectionChanged
Event Type
Type Description
SelectionChangedEventHandler

Extension Methods

DependencyObjectHelper.GetSelfAndAncestors(DependencyObject)
UIElementExtendedRoutedEventExtensions.AddHandler(UIElement, ExtendedRoutedEvent, Delegate, Boolean)
UIElementExtendedRoutedEventExtensions.RemoveHandler(UIElement, ExtendedRoutedEvent, Delegate)
ItemsControlExtensions.GetItemsHost(ItemsControl)
ItemsControlExtensions.GetScrollHost(ItemsControl)
ItemsControlExtensions.GetContainers(ItemsControl)
ItemsControlExtensions.GetContainers<TContainer>(ItemsControl)
ItemsControlExtensions.GetItemsAndContainers(ItemsControl)
ItemsControlExtensions.GetItemsAndContainers<TContainer>(ItemsControl)
VisualTreeExtensions.GetVisualAncestors(DependencyObject)
VisualTreeExtensions.GetVisualAncestorsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualChildren(DependencyObject)
VisualTreeExtensions.GetVisualChildrenAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualDescendants(DependencyObject)
VisualTreeExtensions.GetVisualDescendantsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualSiblings(DependencyObject)
VisualTreeExtensions.GetVisualSiblingsAndSelf(DependencyObject)
VisualTreeExtensions.GetBoundsRelativeTo(FrameworkElement, UIElement)
VisualTreeExtensions.InvokeOnLayoutUpdated(FrameworkElement, Action)
  • Improve this Doc
  • View Source