コード例 #1
0
 /// <summary>
 /// Handles the <see cref="E:Selecting" /> event.
 /// </summary>
 /// <param name="args">The <see cref="SelectingEventArgs"/> instance containing the event data.</param>
 internal void OnSelecting(SelectingEventArgs args)
 {
     if (Selecting != null)
     {
         Selecting(this, args);
     }
 }
コード例 #2
0
        /// <summary>
        /// Called when [selecting].
        /// </summary>
        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);
        }