Skip to content
James Willock edited this page Feb 16, 2016 · 3 revisions

There are a couple of mechanisms to help you add a new tab; choose the mechanism most appropriate for your application.

1 - TabablzControl.AddItemCommand

There is a routed command, which, if executed will add a new tab. Before you use this you should be aware of TabablzControl.NewItemFactory. The client code should provide a Func which creates the content for each new tab item. This could be a view model (you would have DataTemplate available in your XAML) or a DragablzItem.

There are two ways of invoking your NewItemFactory via AddItemCommand:

TabablzControl.ShowDefaultAddButton

This is the easiest way to add new tabs; it will cause the standard themes to show an "add" button. It can be set in XAML like so:

<TabablzControl ShowDefaultAddButton="True" />

Manual

It is possible to execute the command from your own button (typically within the TabablzControl).

<Button Command="{x:Static dragablz:TabablzControl.AddItemCommand}" />

2 - TabablzControl.AddItem

The static AddItem method can be called via code to add a new tab item. The arguments allow you to control where the item should appear (as there maybe multiple active Windows/docks).