This article will list the key properties provided by the RadTabbedWindow control.
RadTabbedWindow allows you to display a header in the top-left part of it. To specify the header you can use either the Header or the HeaderTemplate properties.
Example 1: Set RadTabbedWindow header
<telerik:RadTabbedWindow.Header> <TextBlock Text="RadTabbedWindow" Margin="0 0 10 0" /> </telerik:RadTabbedWindow.Header>
Via the Icon and the IconTemplate properties, you can also define an icon for your RadTabbedWindow.
Example 2: Set window icon
<telerik:RadTabbedWindow.Icon> <Image Source="/Icons/WindowIcon.png" Stretch="None" /> </telerik:RadTabbedWindow.Icon>
By default, when in a data-bound scenario, the content of the tab items will be set to the value returned by the ToString() method of the underlying business objects.
As this is rarely the desired behavior, RadTabbedWindow exposes a DisplayMemberPath property. Its purpose is to specify a property of the source object to serve as the visual representation of the RadTabItem.
Example 3 demonstrates how to set the RadTabbedWindow's DisplayMemberPath property to point to the Header property of the underlying objects.
Example 3: Set the DisplayMemberPath property
<telerik:RadTabbedWindow ... DisplayMemberPath="Header" />
Through the ItemsPanel property, you can define a custom panel for the tab items. If you wish to have tabs with different widths, for example, you can use the default panel of the RadTabControl - the TabWrapPanel - as shown in Example 4.
Example 4: Set the ItemsPanel property
<telerik:RadTabbedWindow.ItemsPanel> <ItemsPanelTemplate> <telerikNavigationPrimitives:TabWrapPanel /> </ItemsPanelTemplate> </telerik:RadTabbedWindow.ItemsPanel>
ItemWidth and ItemMinWidth
Through the ItemWidth and ItemMinWidth, you can control the default Width and MinWidth of the window's RadTabItems. Example 5 shows how to set these properties and their default values.
Example 5: Set ItemWidth and ItemMinWidth
tabbedWindow.ItemWidth = 120; tabbedWindow.ItemMinWidth = 80;
tabbedWindow.ItemWidth = 120 tabbedWindow.ItemMinWidth = 80
The control also exposes a PinnedItems property of type ReadOnlyObservableCollection
By default, the RadTabbedWindow allows reordering of its tabs as well as creating new windows via drag and drop. This drag-drop behavior can be controlled via the DragDropMode property which can have any of the following values:
- None: Drag drop is disabled.
- Reorder: Reorder in tab strip is allowed only.
- Default: DragReorder and drag out of TabControl is allowed (like in modern browsers).
Example 6: Allow only the reorder of tabs via drag and drop
tabbedWindow.DragDropMode = DragDropMode.Reorder;
tabbedWindow.DragDropMode = DragDropMode.Reorder
When the width of the window does not allow all tabs to be displayed, two scrolling buttons appear to the left and to the right side of the tab items. You can choose one of the ScrollMode values in order to control how the tab items should be scrolled. More information about the different modes can be found in this article.
Example 7: Enable the reorder of tabs via drag and drop
tabbedWindow.ScrollMode = TabControlScrollMode.Viewport;
tabbedWindow.ScrollMode = TabControlScrollMode.Viewport
You can determine whether users will be able to add new tabs through the UI be specifying the AddButtonVisibility property.
Example 8: Set AddButtonVisibility
tabbedWindow.AddButtonVisibility = Visibility.Collapsed;
tabbedWindow.AddButtonVisibility = Visibility.Collapsed
The SelectedItemRemoveBehaviour property allows you to choose which RadTabItem should be selected next in case the currently selected RadTabItem is removed. The property can have one of the following values:
SelectNone: No action is performed. Use it to set the SelectedItem to null.
SelectFirst: The first non-disabled and visible item in the Items collection is selected.
SelectLast: The last non-disabled and visible item in the Items collection is selected.
SelectPrevious: The previous non-disabled and visible item in the Items collection is selected. If there is no such item, the next non-disabled and visible item is selected. If there is no such item, no action is performed.
SelectNext: The next non-disabled and visible item in the Items collection is selected. If there is no such item, the previous non-disabled and visible item is selected. If there is no such item, no action is performed.
Example 9: Set SelectedItemRemoveBehaviour
tabbedWindow.SelectedItemRemoveBehaviour = SelectedItemRemoveBehaviour.SelectLast;
tabbedWindow.SelectedItemRemoveBehaviour = SelectedItemRemoveBehaviour.SelectLast
For performance reasons the ControlTemplate of the TabbedWindowTabControl inside the RadTabbedWindow defines a single ContentPresenter which holds only the currently selected RadTabItem's Content. Therefore each time the selection is changed, the content of the last active item is unloaded in order to load the content of the newly-selected item. Since the load/unload operations involve add/remove actions in the visual tree, the content does not keep its state.
However, if you need to keep each RadTabItem's content you can set the IsContentPreserved property to True.
Example 10: Preserve tab item content
tabbedWindow.IsContentPreserved = true;
tabbedWindow.IsContentPreserved = True