'Declaration Public Class RibbonTabItem Inherits Infragistics.Windows.Controls.TabItemEx Implements IKeyTip, IKeyTipContainer
public class RibbonTabItem : Infragistics.Windows.Controls.TabItemEx, IKeyTip, IKeyTipContainer
The RibbonTabItem is a specialized System.Windows.Controls.TabItem designed to be used with the XamRibbon. It can either be directly added to the XamRibbon.Tabs collection or it can be part of a ContextualTabGroup and added to its ContextualTabGroup.Tabs collection.
The RibbonGroups property is used to provide one or more RibbonGroup instances that provide the content for the tab item when it is selected within the XamRibbon (XamRibbon.SelectedTab).
If the tab belongs to a ContextualTabGroup then its ContextualTabGroup property can be used to access the owning group. The IsFirstTabInContextualTabGroup and IsLastTabInContextualTabGroup read-only properties are set the by the ContextualTabGroup to indicate where the tab is visually placed within the tabs collection of the group.
Public Partial Class CodeRibbonWindow Inherits XamRibbonWindow Private xamApplicationMenu As ApplicationMenu Private xamRibbon As XamRibbon Public Sub New() InitializeComponent() initRibbonItems() addRibbonItems() End Sub Private Sub initRibbonItems() 'Create RibbonWindowContentHost Dim xamContentHost As New RibbonWindowContentHost() Me.Content = xamContentHost 'Create XamRibbon object xamRibbon = New XamRibbon() xamContentHost.Ribbon = xamRibbon DockPanel.SetDock(xamRibbon, Dock.Top) End Sub 'add Tabs in XamRibbon control Private Sub addRibbonItems() 'Add tabItem with Header "Format" Dim formatTabItem As New RibbonTabItem() formatTabItem.Header = "Format" formatTabItem.KeyTip = "Ktp" xamRibbon.Tabs.Add(formatTabItem) 'Add RibbonGeoups Dim contextualTabItemGroup As RibbonGroup = getRibbonGroup(irTabItem, "ContextualTabItem") Dim tabItemRibbonGroup As RibbonGroup = getRibbonGroup(irTabItem, "TabItem") Dim formatRibbonGroup As RibbonGroup = getRibbonGroup(irTabItem, "Format") End Sub 'Add RibbonGroup to RibbonTabItem Private Function getRibbonGroup(ByVal igTabItem As RibbonTabItem, ByVal ribbonGroupCaption As String) As RibbonGroup Dim ribbonGroup As New RibbonGroup() ribbonGroup.Caption = ribbonGroupCaption Dim toolHorizontalWrapPanel As New ToolHorizontalWrapPanel() ribbonGroup.Items.Add(toolHorizontalWrapPanel) igTabItem.RibbonGroups.Add(ribbonGroup) Return ribbonGroup End Function End Class
public partial class CodeRibbonWindow : XamRibbonWindow { ApplicationMenu xamApplicationMenu; XamRibbon xamRibbon; public CodeRibbonWindow() { InitializeComponent(); initRibbonItems(); addRibbonItems(); } private void initRibbonItems() { //Create RibbonWindowContentHost RibbonWindowContentHost xamContentHost = new RibbonWindowContentHost(); this.Content = xamContentHost; //Create XamRibbon object xamRibbon = new XamRibbon(); xamContentHost.Ribbon = xamRibbon; DockPanel.SetDock(xamRibbon, Dock.Top); } //add Tabs in XamRibbon control private void addRibbonItems() { //Add tabItem with Header "Format" RibbonTabItem formatTabItem = new RibbonTabItem(); formatTabItem.Header = "Format"; formatTabItem.KeyTip = "Ktp"; xamRibbon.Tabs.Add(formatTabItem); //Add RibbonGeoups RibbonGroup contextualTabItemGroup = getRibbonGroup(irTabItem, "ContextualTabItem"); RibbonGroup tabItemRibbonGroup = getRibbonGroup(irTabItem, "TabItem"); RibbonGroup formatRibbonGroup = getRibbonGroup(irTabItem, "Format"); } //Add RibbonGroup to RibbonTabItem private RibbonGroup getRibbonGroup(RibbonTabItem igTabItem, string ribbonGroupCaption) { RibbonGroup ribbonGroup = new RibbonGroup(); ribbonGroup.Caption = ribbonGroupCaption; ToolHorizontalWrapPanel toolHorizontalWrapPanel = new ToolHorizontalWrapPanel(); ribbonGroup.Items.Add(toolHorizontalWrapPanel); igTabItem.RibbonGroups.Add(ribbonGroup); return ribbonGroup; } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2