バージョン

XamTabControl クラス

複数のレイアウト スタイルおよびタブ項目スクロール機能を持つカスタム タブ コントロール。
シンタックス
'宣言
 
Public Class XamTabControl 
   Inherits System.Windows.Controls.TabControl
public class XamTabControl : System.Windows.Controls.TabControl 
使用例
<Window x:Class="XamTabControl_cs.Window1"
    
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    
Title="Window1" Height="414" Width="670" 
    
xmlns:igWindows="http://infragistics.com/Windows">
    
<Grid>
        
<igWindows:XamTabControl Name="xamTabControl1"
             
TabLayoutStyle="MultiRowSizeToFit"
             
MaximumTabRows="4"
             
MaximumSizeToFitAdjustment="50"
             
MinimumTabExtent="100"
             
InterTabSpacing="2" 
             
InterRowSpacing="2"
             
AllowTabClosing="True"
             
ShowTabHeaderCloseButton="True"
             
TabItemCloseButtonVisibility="WhenSelectedOrHotTracked"
>
            
<igWindows:TabItemEx Header="tab 1" Name="tabItemEx1" >
               
<Grid /> <!-- tab item content goes here -->
            
</igWindows:TabItemEx>

            
<igWindows:TabItemEx Header="tab 2" Name="tabItemEx2" >
               
<Grid /> <!-- tab item content goes here -->
            
</igWindows:TabItemEx>

            
<igWindows:TabItemEx Header="tab 3" Name="tabItemEx3" >
               
<Grid /> <!-- tab item content goes here -->
            
</igWindows:TabItemEx>

        
</igWindows:XamTabControl>
     
</Grid>

</Window>
Imports Infragistics.Windows.Controls
Imports Infragistics.Windows.Controls.Events

Class Window1

    Public Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

        ' tabs will be displayed on multiple rows and sized so fit each row
        Me.XamTabControl1.TabLayoutStyle = TabLayoutStyle.MultiRowSizeToFit

        ' the maximum visible tab rows is set to 4. If the tab control is sized
        ' so there are more than 4 rows then scroll buttons will be displayed
        Me.XamTabControl1.MaximumTabRows = 4

        ' Specify the maximum # of device independent units that can be added 
        ' to each tab item we adjusting to fit the size of the XamTabControl.
        ' Setting this limit prevents the tabs from being resized too large.
        Me.XamTabControl1.MaximumSizeToFitAdjustment = 50

        ' specify the spacing between each tab
        Me.XamTabControl1.InterTabSpacing = 2

        ' specify the spacing between each tab row
        Me.XamTabControl1.InterRowSpacing = 2

        ' specify the minimum extent to each tab
        Me.XamTabControl1.MinimumTabExtent = 100

        ' Allow tab closing by default.
        Me.XamTabControl1.AllowTabClosing = True

        ' Note: tab closing can be overriden on each TabItemEx by setting its AllowClosing
        ' property, e.g.
        TryCast(Me.XamTabControl1.Items(0), TabItemEx).AllowClosing = False

        ' Show a close button in the tab header area that will close the selected tab
        Me.XamTabControl1.ShowTabHeaderCloseButton = True

        ' Show a close button in the TabItemEx if the tab is selected
        ' or if the mouse is over it.
        Me.XamTabControl1.TabItemCloseButtonVisibility = TabItemCloseButtonVisibility.WhenSelectedOrHotTracked

        ' Note: tab item close button visibility can be overriden on each TabItemEx by 
        ' setting its CloseButtonVisibility property, e.g.
        TryCast(Me.XamTabControl1.Items(2), TabItemEx).CloseButtonVisibility = TabItemCloseButtonVisibility.Hidden

        Dim tab As TabItemEx = TryCast(Me.XamTabControl1.Items(1), TabItemEx)

        ' Wire the Closing event for a specific tab. Setting Cancel to true inside the event will 
        ' prevent the tab from being closed
        AddHandler tab.Closing, AddressOf tabItem_Closing

        ' Note: when the XamTabControl closes a tab it leaves it in the Items
        ' collection an just sets the tab item's Visibility to 'Collapsed'.
        ' Therefore, to unclose a tab set its Visibility property back to 'Visible'

    End Sub

    Private Sub tabItem_Closing(ByVal sender As Object, ByVal e As TabClosingEventArgs)
        ' Setting Cancel to true will prevent the tab from being closed
        e.Cancel = True
    End Sub

End Class
using Infragistics.Windows.Controls;
using Infragistics.Windows.Controls.Events;

    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();

            // tabs will be displayed on multiple rows and sized so fit each row
            this.xamTabControl1.TabLayoutStyle = TabLayoutStyle.MultiRowSizeToFit;

            // the maximum visible tab rows is set to 4. If the tab control is sized
            // so there are more than 4 rows then scroll buttons will be displayed
            this.xamTabControl1.MaximumTabRows = 4;

            // Specify the maximum # of device independent units that can be added 
            // to each tab item we adjusting to fit the size of the XamTabControl.
            // Setting this limit prevents the tabs from being resized too large.
            this.xamTabControl1.MaximumSizeToFitAdjustment = 50;

            // specify the spacing between each tab
            this.xamTabControl1.InterTabSpacing = 2;

            // specify the spacing between each tab row
            this.xamTabControl1.InterRowSpacing = 2;

            // specify the minimum extent to each tab
            this.xamTabControl1.MinimumTabExtent = 100;

            // Allow tab closing by default.
            this.xamTabControl1.AllowTabClosing = true;
            
            // Note: tab closing can be overriden on each TabItemEx by setting its AllowClosing
            // property, e.g.
            ((TabItemEx)this.xamTabControl1.Items[0]).AllowClosing = false;

            // Show a close button in the tab header area that will close the selected tab
            this.xamTabControl1.ShowTabHeaderCloseButton = true;

            // Show a close button in the TabItemEx if the tab is selected
            // or if the mouse is over it.
            this.xamTabControl1.TabItemCloseButtonVisibility = TabItemCloseButtonVisibility.WhenSelectedOrHotTracked;
            
            // Note: tab item close button visibility can be overriden on each TabItemEx by 
            // setting its CloseButtonVisibility property, e.g.
            ((TabItemEx)this.xamTabControl1.Items[2]).CloseButtonVisibility = TabItemCloseButtonVisibility.Hidden;

            // Wire the Closing event for a specific tab. Setting Cancel to true inside the event will 
            // prevent the tab from being closed
            ((TabItemEx)this.xamTabControl1.Items[1]).Closing += new EventHandler<TabClosingEventArgs>(tabItemEx2_Closing);

            // Note: when the XamTabControl closes a tab it leaves it in the Items
            // collection an just sets the tab item's Visibility to 'Collapsed'.
            // Therefore, to unclose a tab set its Visibility property back to 'Visible'
        }

        private void tabItemEx2_Closing(object sender, TabClosingEventArgs e)
        {
            // Setting Cancel to true will prevent the tab from being closed
            e.Cancel = true;
        }
参照