Version

GetItemsByKey Method (UltraExplorerBar)

Retrieves an array of all UltraExplorerBarItems in the UltraExplorerBar with the specified Key.
Syntax
'Declaration
 
Public Function GetItemsByKey( _
   ByVal key As String _
) As UltraExplorerBarItem()
public UltraExplorerBarItem[] GetItemsByKey( 
   string key
)

Parameters

key
The key of the item(s) to search for.

Return Value

Array of UltraExplorerBarItem objects with the specified key or null if no UltraExplorerBarItems exist with the specified key.An array of all UltraExplorerBarItems in the UltraExplorerBarGroup with the specified Key.
Remarks

This method searches each UltraExplorerBarGroup for all UltraExplorerBarItems with the specified key. It begins the search with the first Group in the control's Groups collection.

Example
The following code demonstrates how to use the Group's GetItemsByKey method to get an array of all the items in the group that have a specific key. Since UltraExplorerBar does not require that Item keys be unique it is possible to have multiple Items with the same Key.

Imports System.Diagnostics
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinExplorerBar


	Private Sub Button34_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button34.Click

		' For each group, get an array of all Items with a Key of 'DrawingTool' and display the
		' items that were retrieved.

		Dim group As UltraExplorerBarGroup

		For Each group In Me.ultraExplorerBar1.Groups
			' Get an array of all items in the Group with a Key of 'DrawingTool'.
			Dim items As UltraExplorerBarItem() = group.GetItemsByKey("DrawingTool")


			' Display the items that were retrieved.
			If (Not items Is Nothing) Then
				Dim i As Integer

				For i = 0 To items.Length - 1
					Dim item As UltraExplorerBarItem = items.GetValue(i)

					If (Not item Is Nothing) Then
						Debug.WriteLine("Item '" + item.Text + "' found with a Key of 'DrawingTool'")
					End If
				Next
			End If
		Next

	End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinExplorerBar;


		private void button34_Click(object sender, System.EventArgs e)
		{
			// For each group, get an array of all Items with a Key of 'DrawingTool' and display the
			// items that were retrieved.


			foreach(UltraExplorerBarGroup group in this.ultraExplorerBar1.Groups)
			{
				// Get an array of all items in the Group with a Key of 'DrawingTool'.
				UltraExplorerBarItem [] items = group.GetItemsByKey("DrawingTool");


				// Display the items that were retrieved.
				if (items != null)
				{
					for (int i = 0; i < items.Length; i++)
					{
						UltraExplorerBarItem item = items.GetValue(i) as UltraExplorerBarItem;

						if (item != null)
							Debug.WriteLine("Item '" + item.Text + "' found with a Key of 'DrawingTool'");
					}
				}
			}
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, 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