Loading...
Loading...
Comprehensive guide for implementing Syncfusion WPF Tabbed Window control that combines SfChromelessWindow with SfTabControl for document-based applications. Use this skill when implementing chromeless tabbed windows, browser-style tabs, document management windows, or Visual Studio-style tabs in WPF. Covers tear-off tabs, floating tab windows, tab merging between windows, drag-drop tab reordering, and MVVM tab binding scenarios.
npx skill4agent add syncfusion/wpf-ui-components-skills syncfusion-wpf-tabbedwindowSfChromelessWindowSfTabControlSfChromelessWindowSfTabControlSyncfusion.SfChromelessWindow.WPFSyncfusion.Shared.WPFxmlns:syncfusion="http://schemas.syncfusion.com/wpf"WindowTypeCloseButtonVisibilityEnableNewTabButtonNewTabRequestedNewTabButtonStyleItemsSourceItemTemplateContentTemplateItemContainerStyleItemsSourceItemTemplateContentTemplateItemContainerStylePreviewTabMergePreviewTabMergeTabMergePreviewEventArgsAllowDragDrop<Window x:Class="TabbedWindowApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf">
<syncfusion:SfChromelessWindow
Title="Document Manager"
WindowType="Tabbed"
Height="600"
Width="900">
<syncfusion:SfTabControl
AllowDragDrop="True"
EnableNewTabButton="True"
NewTabRequested="OnNewTabRequested">
<syncfusion:SfTabItem
Header="Document 1"
CloseButtonVisibility="Visible">
<TextBlock Text="Welcome to Document 1"
Margin="20"/>
</syncfusion:SfTabItem>
<syncfusion:SfTabItem
Header="Document 2"
CloseButtonVisibility="Visible">
<TextBlock Text="Welcome to Document 2"
Margin="20"/>
</syncfusion:SfTabItem>
</syncfusion:SfTabControl>
</syncfusion:SfChromelessWindow>
</Window>using Syncfusion.Windows.Controls;
public partial class MainWindow : SfChromelessWindow
{
public MainWindow()
{
InitializeComponent();
}
private void OnNewTabRequested(object sender, NewTabRequestedEventArgs e)
{
var tabCount = ((SfTabControl)sender).Items.Count;
var newTab = new SfTabItem
{
Header = $"Document {tabCount + 1}",
Content = new TextBlock
{
Text = $"New Document {tabCount + 1}",
Margin = new Thickness(20)
},
CloseButtonVisibility = Visibility.Visible
};
e.Item = newTab;
}
}<syncfusion:SfChromelessWindow WindowType="Tabbed">
<syncfusion:SfTabControl
AllowDragDrop="True"
EnableNewTabButton="True"
NewTabRequested="OnNewTabRequested">
<!-- Tabs here -->
</syncfusion:SfTabControl>
</syncfusion:SfChromelessWindow><syncfusion:SfTabControl ItemsSource="{Binding OpenDocuments}">
<syncfusion:SfTabControl.ItemContainerStyle>
<Style TargetType="syncfusion:SfTabItem">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding Title}" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</syncfusion:SfTabControl.ItemContainerStyle>
<syncfusion:SfTabControl.ContentTemplate>
<DataTemplate>
<TextBlock Text="{Binding Content}" />
</DataTemplate>
</syncfusion:SfTabControl.ContentTemplate>
</syncfusion:SfTabControl>private void OnPreviewTabMerge(object sender, TabMergePreviewEventArgs e)
{
var draggedItem = e.DraggedItem;
// Validate merge operation
if (draggedItem is DocumentTab doc && doc.IsReadOnly)
{
e.Allow = false;
MessageBox.Show("Cannot move read-only documents");
return;
}
e.Allow = true;
}| Property | Type | Description |
|---|---|---|
| WindowType | |
| bool | Enable drag-drop reordering and tear-off |
| bool | Show/hide the new tab (+) button |
| object | Currently active tab |
| int | Index of active tab |
| IEnumerable | Bind tabs to a collection (MVVM) |
| Visibility | Show/hide close button per tab |
| Event | Description |
|---|---|
| Fired when user clicks the + button; set |
| Fired before tab moves between windows; set |
| Fired when active tab changes |
| Property | Description |
|---|---|
| Style for the new tab button |
| DataTemplate for tab headers |
| DataTemplate for tab content |
| Style for SfTabItem containers |
AllowDragDrop="True"EnableNewTabButton="True"ItemsSourcePreviewTabMergeAllowDragDrop="True"EnableNewTabButton="True"AllowDragDropItemTemplateContentTemplateSyncfusion.SfChromelessWindow.WPFSyncfusion.Shared.WPF