Class TabItem
Represents a selectable item in a TabControl.
Inheritance
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.Controls.dll
Syntax
[TemplatePart(Name = "TemplateTopSelected", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "TemplateBottomSelected", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "TemplateLeftSelected", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "TemplateRightSelected", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "TemplateTopUnselected", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "TemplateBottomUnselected", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "TemplateLeftUnselected", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "TemplateRightUnselected", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "HeaderTopSelected", Type = typeof(ContentControl))]
[TemplatePart(Name = "HeaderBottomSelected", Type = typeof(ContentControl))]
[TemplatePart(Name = "HeaderLeftSelected", Type = typeof(ContentControl))]
[TemplatePart(Name = "HeaderRightSelected", Type = typeof(ContentControl))]
[TemplatePart(Name = "HeaderTopUnselected", Type = typeof(ContentControl))]
[TemplatePart(Name = "HeaderBottomUnselected", Type = typeof(ContentControl))]
[TemplatePart(Name = "HeaderLeftUnselected", Type = typeof(ContentControl))]
[TemplatePart(Name = "HeaderRightUnselected", Type = typeof(ContentControl))]
public class TabItem : ContentControl, IControl, IFrameworkElement, IUIElement, IDependencyObject
Constructors
| Improve this Doc View SourceTabItem()
Initializes a new instance of the TabItem class.
Declaration
public TabItem()
Fields
| Improve this Doc View SourceHasHeaderProperty
Identifies the HasHeader dependency property.
Declaration
public static readonly DependencyProperty HasHeaderProperty
Field Value
Type | Description |
---|---|
DependencyProperty | The identifier for the HasHeader dependency property. |
HeaderProperty
Identifies the Header dependency property.
Declaration
public static readonly DependencyProperty HeaderProperty
Field Value
Type | Description |
---|---|
DependencyProperty | The identifier for the Header dependency property. |
HeaderTemplateProperty
Identifies the HeaderTemplate dependency property.
Declaration
public static readonly DependencyProperty HeaderTemplateProperty
Field Value
Type | Description |
---|---|
DependencyProperty | The identifier for the HeaderTemplate dependency property. |
IsFocusedProperty
Identifies the IsFocused dependency property.
Declaration
public static readonly DependencyProperty IsFocusedProperty
Field Value
Type | Description |
---|---|
DependencyProperty | The identifier for the IsFocused dependency property. |
IsSelectedProperty
Identifies the IsSelected dependency property.
Declaration
public static readonly DependencyProperty IsSelectedProperty
Field Value
Type | Description |
---|---|
DependencyProperty | The identifier for the IsSelected dependency property. |
Properties
| Improve this Doc View SourceHasHeader
Gets a value indicating whether the TabItem has a header.
Declaration
public bool HasHeader { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if Header is not null; otherwise, false. |
Header
Gets or sets the header of the TabItem.
Declaration
public object Header { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The current header of the TabItem. |
HeaderTemplate
Gets or sets the template that is used to display the content of the TabItem header.
Declaration
public DataTemplate HeaderTemplate { get; set; }
Property Value
Type | Description |
---|---|
DataTemplate | The current template that is used to display TabItem header content. |
IsFocused
Gets a value indicating whether this element has logical focus.
Declaration
public bool IsFocused { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsSelected
Gets or sets a value indicating whether the TabItem is currently selected.
Declaration
public bool IsSelected { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the TabItem is selected; otherwise, false. |
TabStripPlacement
Gets the location of the tab strip relative to the TabItem content.
Declaration
public Dock TabStripPlacement { get; }
Property Value
Type | Description |
---|---|
Dock | The location of the tab strip relative to the TabItem content. |
Methods
| Improve this Doc View SourceOnApplyTemplate()
Builds the visual tree for the TabItem when a new template is applied.
Declaration
public override void OnApplyTemplate()
Overrides
| Improve this Doc View SourceOnContentChanged(Object, Object)
This method is invoked when the Content property changes.
Declaration
protected override void OnContentChanged(object oldContent, object newContent)
Parameters
Type | Name | Description |
---|---|---|
System.Object | oldContent | The previous TabItem content. |
System.Object | newContent | The new TabItem content. |
Overrides
| Improve this Doc View SourceOnCreateAutomationPeer()
Creates and returns an AutomationPeer for this TabItem.
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type | Description |
---|---|
AutomationPeer | An automation peer for this TabItem. |
Overrides
| Improve this Doc View SourceOnHeaderChanged(Object, Object)
Called when the Header property changes.
Declaration
protected virtual void OnHeaderChanged(object oldHeader, object newHeader)
Parameters
Type | Name | Description |
---|---|---|
System.Object | oldHeader | The previous value of the Header property. |
System.Object | newHeader | The new value of the Header property. |
OnHeaderTemplateChanged(DataTemplate, DataTemplate)
Called when the HeaderTemplate property changes.
Declaration
protected virtual void OnHeaderTemplateChanged(DataTemplate oldHeaderTemplate, DataTemplate newHeaderTemplate)
Parameters
Type | Name | Description |
---|---|---|
DataTemplate | oldHeaderTemplate | The previous value of the HeaderTemplate property. |
DataTemplate | newHeaderTemplate | The new value of the HeaderTemplate property. |
OnIsFocusChanged(DependencyPropertyChangedEventArgs)
Called when the IsFocused property changes.
Declaration
protected virtual void OnIsFocusChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DependencyPropertyChangedEventArgs | e | A DependencyPropertyChangedEventArgs that contains the event data. |
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 | A KeyEventArgs that contains the event data. |
Overrides
| Improve this Doc View SourceOnSelected(RoutedEventArgs)
Called to indicate that the IsSelected property has changed to true.
Declaration
protected virtual void OnSelected(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
RoutedEventArgs | e | A RoutedEventArgs that contains the event data. |
OnUnselected(RoutedEventArgs)
Called to indicate that the IsSelected property has changed to false.
Declaration
protected virtual void OnUnselected(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
RoutedEventArgs | e | A RoutedEventArgs that contains the event data. |