-
Notifications
You must be signed in to change notification settings - Fork 3
TabControl
Back to home | Back to Reference | View raw text
A control that can house multiple controls under a number of tabs. Each tab has a title, icon, and close button (see TabItem ).
flowchart LR
classDef interfaceStyle stroke-dasharray: 5 5;
classDef abstractStyle stroke-width:4px
subgraph SolidShineUi
SolidShineUi.TabControl[[TabControl]]
end
subgraph System.Windows.Controls
System.Windows.Controls.Control[[Control]]
end
System.Windows.Controls.Control --> SolidShineUi.TabControl
Type | Name | Methods |
---|---|---|
bool |
AllowTabDragDrop Get or set if tabs can be dragged and dropped. |
get, set |
ColorScheme |
ColorScheme Get or set the color scheme to apply to the control. The color scheme can quickly apply a whole visual style to your control. |
get, set |
TabItem |
CurrentTab Get the tab currently selected. Use Items.Select() to select another tab. |
get |
double |
HorizontalTabBarHeight Get or set the height of the horizontal tab bar. The default value is 24. |
get, set |
SelectableCollection <TabItem > |
Items Get or set the list of tabs in this TabControl. This Items property can be used to add tabs, remove tabs, and also select tabs via the Select method. |
get |
UIElement |
LeftTabBarElement Get or set the element to display on the left side of the tab bar. |
get, set |
UIElement |
RightTabBarElement Get or set the element to display on the right side of the tab bar (to the left of the Tab List Menu). |
get, set |
bool |
ScrollButtonsVisible Get if the scroll buttons are currently visible in the tab bar. |
get |
bool |
SelectFirstTabOnLoad Get or set if the first tab should be selected right away when the control is loaded. This property has no effect after the control is loaded. |
get, set |
TabItem |
SelectedTab Get the tab currently selected. Use Items.Select() to select another tab. |
get |
SelectedTabCloseAction |
SelectedTabClosedAction Get or set the action to take when the currently selected tab is closed. |
get, set |
UIElement |
SelectedTabContent Get the currently shown content in the main part of the control. This is the content of the currently selected tab. |
get |
bool |
ShowTabListMenu Get or set if a tab list menu should be shown on the far-right edge of the control's tab bar, listing all the open tabs. This mimics a similar menu found in Visual Studio. |
get, set |
bool |
ShowTabsOnBottom Get or set if the tab bar should be shown at the bottom of the control, rather than the top. |
get, set |
double |
TabMinWidth Get or set the minimum width a tab should have in the tab bar. While tabs may be wider than this width, they will never be shorter than it. |
get, set |
Returns | Name |
---|---|
void |
ApplyColorScheme (ColorScheme cs)Apply a color scheme to this control. The color scheme can quickly apply a whole visual style to the control. |
void |
CloseTab (TabItem tab)Close a specific tab in this TabControl. |
Returns | Name |
---|---|
void |
SetupTabDisplay (TabDisplayItem tdi)Set up a new TabDisplayItem that was added to this TabControl. This will set up the necessary event handlers and other properties to allow the TabDisplayItem to interact with the TabControl. |
Returns | Name |
---|---|
void |
OnColorSchemeChanged (DependencyObject d, DependencyPropertyChangedEventArgs e)Perform an action when the ColorScheme property has changed. Primarily used internally. |
A control that can house multiple controls under a number of tabs. Each tab has a title, icon, and close button (see TabItem ).
Control
public TabControl()
Create a TabControl.
public void CloseTab(TabItem tab)
Type | Name | Description |
---|---|---|
TabItem |
tab | The tab to close. |
Close a specific tab in this TabControl.
If tab
is not in this TabControl, or if the tab closing is cancelled via the TabClosing event, then nothing will happen.
This does not take the tab
's CanClose
property into account; the tab will be closed regardless.
public static void OnColorSchemeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
Type | Name | Description |
---|---|---|
DependencyObject |
d | The object containing the property that changed. |
DependencyPropertyChangedEventArgs |
e | Event arguments about the property change. |
Perform an action when the ColorScheme property has changed. Primarily used internally.
public void ApplyColorScheme(ColorScheme cs)
Type | Name | Description |
---|---|---|
ColorScheme |
cs | The color scheme to apply. |
Apply a color scheme to this control. The color scheme can quickly apply a whole visual style to the control.
protected internal void SetupTabDisplay(TabDisplayItem tdi)
Type | Name | Description |
---|---|---|
TabDisplayItem |
tdi | The TabDisplayItem to set up. |
Set up a new TabDisplayItem that was added to this TabControl. This will set up the necessary event handlers and other properties to allow the TabDisplayItem to interact with the TabControl.
public bool SelectFirstTabOnLoad { get; set; }
Get or set if the first tab should be selected right away when the control is loaded. This property has no effect after the control is loaded.
public SelectableCollection<TabItem> Items { get; }
Get or set the list of tabs in this TabControl. This Items property can be used to add tabs, remove tabs, and also select tabs via the Select method.
public TabItem SelectedTab { get; }
Get the tab currently selected. Use Items.Select()
to select another tab.
public UIElement SelectedTabContent { get; }
Get the currently shown content in the main part of the control. This is the content of the currently selected tab.
public TabItem CurrentTab { get; }
Get the tab currently selected. Use Items.Select()
to select another tab.
public bool ShowTabsOnBottom { get; set; }
Get or set if the tab bar should be shown at the bottom of the control, rather than the top.
public double HorizontalTabBarHeight { get; set; }
Get or set the height of the horizontal tab bar. The default value is 24.
public UIElement LeftTabBarElement { get; set; }
Get or set the element to display on the left side of the tab bar.
public UIElement RightTabBarElement { get; set; }
Get or set the element to display on the right side of the tab bar (to the left of the Tab List Menu).
public bool ShowTabListMenu { get; set; }
Get or set if a tab list menu should be shown on the far-right edge of the control's tab bar, listing all the open tabs. This mimics a similar menu found in Visual Studio.
public double TabMinWidth { get; set; }
Get or set the minimum width a tab should have in the tab bar. While tabs may be wider than this width, they will never be shorter than it.
public SelectedTabCloseAction SelectedTabClosedAction { get; set; }
Get or set the action to take when the currently selected tab is closed.
Clearing the selection (via Items.ClearSelection
or other methods) will trigger this action as well, meaning the TabControl will attempt to select another tab if
this action is not SelectNothing
. If you need to clear the selection, you'll need to set this property to SelectNothing
first, clear the selection, and then reset
this to whatever value you had previously (by default, the value is SelectTabToLeft
).
When a tab that isn't currently the selected tab is closed, that is not affected with this property.
public bool AllowTabDragDrop { get; set; }
Get or set if tabs can be dragged and dropped.
Note that dragging and dropping tabs between TabControls is not currently supported.
public ColorScheme ColorScheme { get; set; }
Get or set the color scheme to apply to the control. The color scheme can quickly apply a whole visual style to your control.
public bool ScrollButtonsVisible { get; }
Get if the scroll buttons are currently visible in the tab bar.
public event TabItemChangeEventHandler TabChanged
Raised when the tab currently selected is changed.
public event TabItemClosingEventHandler TabClosing
Raised when a tab is about to be closed, with the ability to cancel the action.
public event TabItemChangeEventHandler TabClosed
Raised when a tab is closed.
public event EventHandler TabsCleared
Raised when all tabs are closed at once (via Items.Clear()
).
protected event DependencyPropertyChangedEventHandler InternalShowTabsOnBottomChanged
Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".
public event DependencyPropertyChangedEventHandler ShowTabsOnBottomChanged
Raised when the ShowTabsOnBottom property is changed.
protected event DependencyPropertyChangedEventHandler InternalHorizontalTabBarHeightChanged
Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".
public event DependencyPropertyChangedEventHandler HorizontalTabBarHeightChanged
Raised when the HorizontalTabBarHeight property is changed.
protected event DependencyPropertyChangedEventHandler InternalShowTabListMenuChanged
Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".
public event DependencyPropertyChangedEventHandler ShowTabListMenuChanged
Raised when the ShowTabListMenu property is changed.
protected event DependencyPropertyChangedEventHandler InternalTabMinWidthChanged
Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".
public event DependencyPropertyChangedEventHandler TabMinWidthChanged
Raised when the TabMinWidth property is changed.
protected event DependencyPropertyChangedEventHandler InternalAllowTabDragDropChanged
Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".
public event DependencyPropertyChangedEventHandler AllowTabDragDropChanged
Raised when the AllowTabDragDrop property is changed.
public delegate void TabItemChangeEventHandler(object sender, TabItemChangeEventArgs e)
Type | Name | Description |
---|---|---|
object |
sender | |
TabItemChangeEventArgs |
e |
public delegate void TabItemClosingEventHandler(object sender, TabItemClosingEventArgs e)
Type | Name | Description |
---|---|---|
object |
sender | |
TabItemClosingEventArgs |
e |
Generated with ModularDoc