バージョン

MaxMRUItems プロパティ

エディターのMRUリストに表示される項目の最大数を取得または設定します。
シンタックス
'宣言
 
Public Overridable Property MaxMRUItems As Integer
public virtual int MaxMRUItems {get; set;}
解説

MRU は「Most Recently Used」の頭字語です。コントロールのMRUリストにはエンドユーザーが最近選択した項目のテキストが含まれます。

項目が選択されるときに HasMRUList プロパティがTrueに設定される場合、項目のコピーがリストのMRU部分の一番上に追加されます。MRUリストに含まれるその他の項目がある場合下に移動されます。MRU部分の項目数がMaxMRUItemsプロパティによって指定される値を超えるまでこのプロセスは続行します。これが発生する場合最も古い項目がリストから削除されます。

使用例
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinEditors

    Private Sub SetupMRUList()
        '	Remove the existing items from the control's Items collection
        Me.UltraComboEditor1.Items.Clear()

        '	Add items to the control's Items collection, using the overload
        '	that allows us to specify a data value and display text
        Me.UltraComboEditor1.Items.Add(1, "One")
        Me.UltraComboEditor1.Items.Add(2, "Two")
        Me.UltraComboEditor1.Items.Add(3, "Three")
        Me.UltraComboEditor1.Items.Add(4, "Four")
        Me.UltraComboEditor1.Items.Add(5, "Five")

        '	Set the HasMRUList property to true, so the MRUList will be displayed
        Me.UltraComboEditor1.HasMRUList = True

        '	The MRUList will be initially empty, but we can pre-populate
        '	it by setting the MRUList property. Create and object array
        '	with 3 elements, and add the data values of the odd-numbered
        '	items to the array. This will cause them to appear in the MRUList
        '	the first time the list portion appears.
        '
        '	Create an object array
        Dim mruItems(Me.UltraComboEditor1.Items.Count) As Object

        '	Iterate the items in the control's Items collection; for each item
        '	whose data value is an odd number, add an element to the array.
        Dim i As Integer
        For i = 0 To Me.UltraComboEditor1.Items.Count
            Dim valueListItem As ValueListItem = Me.UltraComboEditor1.Items(i)
            Dim dataVal As Integer = valueListItem.DataValue
            If ((dataVal Mod 2) <> 0) Then
                mruItems(i) = dataVal
            End If
        Next

        '	Set the control's MRUList property to the object array
        '	Note that the MRU items that do not match an item in
        '	the control's Items collection will be removed , since MRU
        '	items only have relevance when they match an item.
        Me.UltraComboEditor1.MRUList = mruItems

        '	Set the MaxMRUItems property to 3 so that no more than
        '	3 items appear in the MRUList.
        Me.UltraComboEditor1.MaxMRUItems = 3

        '	Select the first item in the Items collection
        Me.UltraComboEditor1.SelectedIndex = 0
    End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinEditors;

		private void SetupMRUList()
		{
			//	Remove the existing items from the control's Items collection
			this.ultraComboEditor1.Items.Clear();

			//	Add items to the control's Items collection, using the overload
			//	that allows us to specify a data value and display text
			this.ultraComboEditor1.Items.Add( 1, "One" );
			this.ultraComboEditor1.Items.Add( 2, "Two" );
			this.ultraComboEditor1.Items.Add( 3, "Three" );
			this.ultraComboEditor1.Items.Add( 4, "Four" );
			this.ultraComboEditor1.Items.Add( 5, "Five" );

			//	Set the HasMRUList property to true, so the MRUList will be displayed
			this.ultraComboEditor1.HasMRUList = true;

			//	The MRUList will be initially empty, but we can pre-populate
			//	it by setting the MRUList property. Create and object array
			//	with 3 elements, and add the data values of the odd-numbered
			//	items to the array. This will cause them to appear in the MRUList
			//	the first time the list portion appears.
			//
			//	Create an object array the same size as the cotrol's Items collection
			object[] mruItems = new object[this.ultraComboEditor1.Items.Count];

			//	Iterate the items in the control's Items collection; for each item
			//	whose data value is an odd number, add an element to the array.
			for ( int i = 0; i < this.ultraComboEditor1.Items.Count; i ++ )
			{
				ValueListItem valueListItem = this.ultraComboEditor1.Items[i];
				int dataVal = (int)(valueListItem.DataValue);
				if ( ( dataVal % 2 ) != 0 )
					mruItems[i] = dataVal;

			}

			//	Set the control's MRUList property to the object array
			//	Note that the MRU items that do not match an item in
			//	the control's Items collection will be removed , since MRU
			//	items only have relevance when they match an item.
			this.ultraComboEditor1.MRUList = mruItems;

			//	Set the MaxMRUItems property to 3 so that no more than
			//	3 items appear in the MRUList.
			this.ultraComboEditor1.MaxMRUItems = 3;

			//	Select the first item in the Items collection
			this.ultraComboEditor1.SelectedIndex = 0;
		}
参照