Tabcontrol for avalonia
$ dotnet add package ThingLing.Avalonia.Controls.TabControlDefination:
This tabcontrol is built from a UserControl.
Usage:
from xaml:
xmlns:tab="clr-namespace:ThingLing.Controls;assembly=ThingLing.Controls.TabControl"
Default TabMode=Document
<tab:TabControl x:Name="_tabControl" />
<tab:TabControl x:Name="_tabControl" TabMode="Document" />
or
<tab:TabControl x:Name="_tabControl" TabMode="Window" />
from code:
using ThingLing.Controls;
TabControl tabControl = new TabControl();
grid.Children.Add(tabControl);
to add a TabItem:
var tabItem = new TabItem
{
Header = $"Hello RichTextBox {++i}",
Content = new TextBox { Text = $"Helloo {i}", TextWrapping = TextWrapping.Wrap },
ToolTip = $"RichTextBox {i}"
};
_tabControl.Add(tabItem);
properties:
TabMode
TabStripPlacementSide
TabItemRotationAngle
TabItemsCount
SelectedTabItem
TabTheme (set the colors of the TabControl elements using TabControlTheme class available in the namespace ThingLing.Controls.Props then pass it as a value of the TabTheme constructor)
CollapseVisibilityWhenEmpty
AlwaysVisible
HideNewTabButton
HideOpenTabsButton
methods:
Add(TabItem tabItem)
Remove(TabItem tabItem)
RemoveAt(int tabIndex)
RemoveAll()
events:
TabItemAdded
TabItemRemoved
NewTabItemButtonClicked