Exemplo n.º 1
0
 public ListDataLayer(RadListElement owner)
 {
     this.owner      = owner;
     this.listSource = this.CreateListSource();
     this.items      = this.CreateItemsCollection(owner);
     this.listSource.CollectionView.GroupDescriptors.Add("GroupKey", ListSortDirection.Ascending);
     this.WireEvents();
 }
Exemplo n.º 2
0
        protected virtual void SuggestOverride(string pattern)
        {
            int selectedIndex = this.SelectedIndex;

            this.patternText = pattern;
            this.SuspendSuggestNotifications();
            if (selectedIndex >= 0)
            {
                RadListDataItem radListDataItem = this.Items[selectedIndex];
                radListDataItem.Selected = false;
                radListDataItem.Active   = false;
            }
            this.DataLayer.Refresh();
            this.SelectedIndex = -1;
            this.ResumeSuggestNotifications();
            RadListDataItemCollection items = this.DataLayer.Items;
            int count = items.Count;

            if (count > 0)
            {
                this.UpdateLayout();
                this.ScrollToItem(items.First);
            }
            bool   flag = this.IsAppendMode && count > 0;
            string str  = string.Empty;

            if (flag)
            {
                str = this.GetSuggestedText(items.First, true);
            }
            else if (!this.IsSuggestMode && this.IsAppendMode)
            {
                str = this.patternText;
            }
            else if (count == 1)
            {
                str = this.GetSuggestedText(items.First, false);
            }
            AutoCompleteAction action = AutoCompleteAction.None;

            if (flag && !this.IsExactSuggestion(str, this.patternText))
            {
                action = AutoCompleteAction.Append;
            }
            this.SetSuggestedText(str, action);
        }