MRU is an acronym for 'Most Recently Used'. The control's MRU list contains the text of the items that were most recently selected by the end user.
When the HasMRUList property is set to true, as items are selected, a copy of the item is added to the top of the MRU portion of the list. The other items contained in the MRU list, if any, are moved down. This process continues until the number of items in the MRU portion exceeds the value specified by the MaxMRUItems property. When this happens, the 'oldest' item is removed from the list.
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; }
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