Imports Infragistics.Win Imports Infragistics.Win.UltraWinTabs Imports Infragistics.Win.UltraWinTabControl Private Sub ultraTabStripControl1_TabDataInitialized(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTabControl.TabDataInitializedEventArgs) Handles ultraTabStripControl1.TabDataInitialized ' This event is raised for data bound UltraTabStripControls ' only. It is raised for every row in the data source. ' Get the associated DataRowView object Dim drView As DataRowView drView = Me.ultraTabStripControl1.GetListObjectFromTab(e.Tab) Dim sb As System.Text.StringBuilder ' Build the text string to display in the tab sb = New System.Text.StringBuilder() sb.Append(drView("CustomerID")) sb.Append(" - ") sb.Append(drView("CustomerName")) ' Set the tab's Text property e.Tab.Text = sb.ToString() ' Build the tooltip text for the tab sb = New System.Text.StringBuilder() sb.Append(drView("Address")) sb.Append(", ") sb.Append(drView("City")) sb.Append(", ") sb.Append(drView("Region")) sb.Append(", ") sb.Append(drView("Country")) ' Set the tab's ToolTipText property e.Tab.ToolTipText = sb.ToString() ' Hide tabs based on certain criteria If Not drView("Country") = "USA" Then e.Tab.Visible = False End If ' Disable tabs based on certain criteria If drView("City") = "Seattle" Then e.Tab.Enabled = False End If ' Highlight tabs based on certain criteria If drView("Region") = "OR" Then ' Set default appearance properties for this tab e.Tab.Appearance.ForeColor = Color.Red ' Set appearance properties for this tab when ' it is the ActiveTab (has input focus) e.Tab.ActiveAppearance.ForeColor = Color.Blue ' Set appearance properties for this tab when ' the mouse is over it and the control's ' HotTrack property is true. e.Tab.HotTrackAppearance.ForeColor = Color.Aqua ' Set appearance properties for this tab when ' it is the SelectedTab. e.Tab.SelectedAppearance.ForeColor = Color.Blue e.Tab.SelectedAppearance.FontData.Bold = DefaultableBoolean.True End If End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabControl; private void ultraTabStripControl1_TabDataInitialized(object sender, Infragistics.Win.UltraWinTabControl.TabDataInitializedEventArgs e) { // This event is raised for data bound UltraTabStripControls // only. It is raised for every row in the data source. // Get the associated DataRowView object DataRowView dataRowView = this.ultraTabStripControl1.GetListObjectFromTab( e.Tab ) as DataRowView; // Build the text string to display in the tab System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(dataRowView["CustomerID"]); sb.Append(" - "); sb.Append(dataRowView["CustomerName"]); // Set the tab's Text property e.Tab.Text = sb.ToString(); // Build the tooltip text for the tab sb = new System.Text.StringBuilder(); sb.Append(dataRowView["Address"]); sb.Append(", "); sb.Append(dataRowView["City"]); sb.Append(", "); sb.Append(dataRowView["Region"]); sb.Append(", "); sb.Append(dataRowView["Country"]); // Set the tab's ToolTipText property e.Tab.ToolTipText = sb.ToString(); // Hide tabs based on certain criteria if ( (string)dataRowView["Country"] != "USA" ) e.Tab.Visible = false; // Disable tabs based on certain criteria if ( (string)dataRowView["City"] == "Seattle" ) e.Tab.Enabled = false; // Highlight tabs based on certain criteria if ( (string)dataRowView["Region"] == "OR" ) { // Set default appearance properties for this tab e.Tab.Appearance.ForeColor = Color.Red; // Set appearance properties for this tab when // it is the ActiveTab (has input focus) e.Tab.ActiveAppearance.ForeColor = Color.Blue; // Set appearance properties for this tab when // the mouse is over it and the control's // HotTrack property is true. e.Tab.HotTrackAppearance.ForeColor = Color.Aqua; // Set appearance properties for this tab when // it is the SelectedTab. e.Tab.SelectedAppearance.ForeColor = Color.Blue; e.Tab.SelectedAppearance.FontData.Bold = DefaultableBoolean.True; } }