Version

IsInContextualTabGroup Property (RibbonTabItem)

Returns a boolean indicating whether the tab is part of a ContextualTabGroup
Syntax
'Declaration
 
Public ReadOnly Property IsInContextualTabGroup As Boolean
public bool IsInContextualTabGroup {get;}
Example
RibbontabItem Properties

1. Private xamApplicationMenu As ApplicationMenu
 2. Private xamRibbon As XamRibbon
 3. Private Sub TabGroupProperties()
 4.
 5. 'Get properties for all RibbontabItems
 6.     Dim resultString As String = ""
 7.    
 8.     For Each igTabItem As RibbonTabItem In xamRibbon.Tabs
 9.         resultString += getTabItemParams(igTabItem)
10.     Next
11.     For Each ctgTabGroup As ContextualTabGroup In xamRibbon.ContextualTabGroups
12.         For Each igTabItem As RibbonTabItem In ctgTabGroup.Tabs
13.             resultString += getTabItemParams(igTabItem)
14.         Next
15.     Next
16.     MessageBox.Show(resultString)
17. End Sub
18.
19. 'Get properties for specified RibbontabItem
20. Private Function getTabItemParams(ByVal igTabItem As RibbonTabItem) As String
21.     Dim result As String = ""
22.     If igTabItem.IsInContextualTabGroup Then
23.         result += igTabItem.Header + " TabItem is in ContextualTabGroup"
24.         result += " named " + igTabItem.ContextualTabGroup.Caption
25.         If igTabItem.IsFirstTabInContextualTabGroup Then
26.             result += " - FirstTabInContextualTabGroup"
27.         End If
28.         If igTabItem.IsLastTabInContextualTabGroup Then
29.             result += " - LastTabInContextualTabGroup"
30.         End If
31.     Else
32.         result += igTabItem.Header + " TabItem is not in ContextualTabGroup"
33.     End If
34.     result += " : Number of Groups-" + igTabItem.RibbonGroups.Count.ToString()
35.     If igTabItem.IsMouseOverTab Then
36.         result += " : mouse is over this RibbonTabItem"
37.     End If
38.    
39.     result += "" & Chr(10) & ""
40.     Return result
41. End Function
ApplicationMenu xamApplicationMenu;
XamRibbon xamRibbon;

//Get properties for all RibbontabItems
void TabGroupProperties()
{
	string resultString = "";
	
	foreach (RibbonTabItem igTabItem in xamRibbon.Tabs)
	{
		resultString += getTabItemParams(igTabItem);
	}
	foreach (ContextualTabGroup ctgTabGroup in xamRibbon.ContextualTabGroups)
	{
		foreach (RibbonTabItem igTabItem in ctgTabGroup.Tabs)                {
			resultString += getTabItemParams(igTabItem);
		}
	}
	MessageBox.Show(resultString);
}

//Get properties for specified RibbontabItem
string getTabItemParams(RibbonTabItem igTabItem)
{
	string result = "";
	if (igTabItem.IsInContextualTabGroup)
	{
		result += igTabItem.Header + " TabItem is in ContextualTabGroup";
		result += " named " + igTabItem.ContextualTabGroup.Caption;
		if (igTabItem.IsFirstTabInContextualTabGroup)
		{
			result += " - FirstTabInContextualTabGroup";
		}
		if (igTabItem.IsLastTabInContextualTabGroup)
		{
			result += " - LastTabInContextualTabGroup";
		}
	}
	else
	{
		result += igTabItem.Header + " TabItem is not in ContextualTabGroup";
	}
	result += " : Number of Groups-" + igTabItem.RibbonGroups.Count.ToString();
	if (igTabItem.IsMouseOverTab)
	{
		result += " : mouse is over this RibbonTabItem";
	}

	result += "\n";
	return result;
}
Requirements

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

See Also