'宣言 Public Property SelectedItem As Infragistics.Win.ValueListItem
public Infragistics.Win.ValueListItem SelectedItem {get; set;}
SelectedItem プロパティは、ドロップダウン リストの項目に設定でき、その動作が発生すると、コントロールの編集部分は項目のテキストを表示し、SelectedIndex プロパティは項目のインデックスを返します。
Items コレクションは型 Infragistics.Win.ValueListItemsCollection のコレクションです。
同様に、SelectedItem プロパティは Infragistics.Win.ValueListItem のタイプです。
Private Sub SelectString(ByVal str As String) ' Attempt to find passed in string. Dim index As Integer = Me.UltraComboEditor1.FindString(str) If index <> -1 Then ' String has been found, highlight it. First restore appearance on non ' highlighted items Dim i As Integer For i = 0 To Me.UltraComboEditor1.Items.Count - 1 If i <> index Then Me.UltraComboEditor1.Items(i).Appearance.FontData.Reset() Me.UltraComboEditor1.Items(i).Appearance.ResetBackColor() End If Next i ' Highlight the found item in the list Dim item As Infragistics.Win.ValueListItem = Me.UltraComboEditor1.Items(index) item.Appearance.BackColor = Color.Yellow item.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True ' Set the selected item Me.UltraComboEditor1.SelectedItem = item End If End Sub
private void SelectString(string str) { // Attempt to find passed in string. int index = this.ultraComboEditor1.FindString(str); if (index != -1) { // String has been found, highlight it. First restore appearance on non // highlighted items for(int i = 0; i < this.ultraComboEditor1.Items.Count ; i++) { if (i != index) { this.ultraComboEditor1.Items[i].Appearance.FontData.Reset(); this.ultraComboEditor1.Items[i].Appearance.ResetBackColor(); } } // Highlight the found item in the list Infragistics.Win.ValueListItem item = this.ultraComboEditor1.Items[index] as Infragistics.Win.ValueListItem; item.Appearance.BackColor = Color.Yellow; item.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True ; // Set the selected item this.ultraComboEditor1.SelectedItem = item; } }