'宣言 Public Class RibbonTabItem Inherits Infragistics.Windows.Controls.TabItemEx Implements IKeyTip, IKeyTipContainer
public class RibbonTabItem : Infragistics.Windows.Controls.TabItemEx, IKeyTip, IKeyTipContainer
RibbonTabItem は XamRibbon と使用されるように設計された特別の System.Windows.Controls.TabItem です。これは XamRibbon.Tabs コレクションに直接追加するか、ContextualTabGroup の一部にして ContextualTabGroup.Tabs コレクションに追加することができます。
RibbonGroups プロパティは、XamRibbon(XamRibbon.SelectedTab)内で選択された時にタブ項目にコンテンツを提供するひとつ以上の RibbonGroup インスタンスを提供するために使用されます。
タブが ContextualTabGroup に属する場合、その ContextualTabGroup プロパティは所有するグループにアクセスするために使用できます。IsFirstTabInContextualTabGroup および IsLastTabInContextualTabGroup 読み取りプロパティは、タブがグループのタブ コレクション内に視覚的に配置される場所を示すために ContextualTabGroup によって設定されます。
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; } }