示例#1
0
 internal void OnSelecting(SelectingEventArgs args)
 {
     if (Selecting != null)
     {
         Selecting(this, args);
     }
 }
示例#2
0
        internal virtual void OnSelecting()
        {
            if (SelectedItemIndex < 0 || SelectedItemIndex >= VisibleItems.Count)
            {
                return;
            }

            AutocompleteItem item = VisibleItems[SelectedItemIndex];
            var args = new SelectingEventArgs
            {
                Item          = item,
                SelectedIndex = SelectedItemIndex
            };

            OnSelecting(args);

            if (args.Cancel)
            {
                SelectedItemIndex = args.SelectedIndex;
                (Host.ListView as Control).Invalidate(true);
                return;
            }

            if (!args.Handled)
            {
                Range fragment = Fragment;
                ApplyAutocomplete(item, fragment);
            }

            Close();

            var args2 = new SelectedEventArgs
            {
                Item    = item,
                Control = TargetControlWrapper.TargetControl
            };

            item.OnSelected(args2);
            OnSelected(args2);
        }