public static void AddToSelection(IntPtr controlHandle, int index)
        {
            try
            {
                AutomationElement control = CommonUIAPatternHelpers.Prologue(SelectionPattern.Pattern, controlHandle);

                StaticEvents.RegisterEvent(SelectionItemPattern.ElementAddedToSelectionEvent, control);
                SelectionItemPatternHelper.AddToSelection(control, index);

                LogController.ReceiveLogMessage(new LogMessage(control.Current.Name));
            }
            catch (InvalidOperationException)
            {
                /* Call native function */
                ProdListBoxNative.AddSelectedItemNative(controlHandle, index);
            }
            catch (ElementNotAvailableException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ArgumentException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
        }
        /// <summary>
        /// Adds the list item to the current selection using UIA
        /// </summary>
        /// <param name="control">The base ProdUI control.</param>
        /// <param name="index">Zero based index of the item.</param>
        private static void UiaAddToSelection(BaseProdControl control, int index)
        {
            if (!UiaCanSelectMultiple(control))
            {
                throw new ProdOperationException("Does not support multiple selection");
            }

            AutomationEventVerifier.Register(new EventRegistrationMessage(control, SelectionItemPattern.ElementAddedToSelectionEvent));

            LogController.ReceiveLogMessage(new LogMessage("Adding " + index));
            SelectionItemPatternHelper.AddToSelection(control.UIAElement, index);
        }
        private static void UiaSelectAll(BaseProdControl control)
        {
            if (!UiaCanSelectMultiple(control))
            {
                throw new ProdOperationException("Does not support multiple selection");
            }

            foreach (AutomationElement item in SelectionItemPatternHelper.GetListItems(control.UIAElement))
            {
                SelectionItemPatternHelper.AddToSelection(control.UIAElement, item.Current.Name);
            }
        }
        /// <summary>
        /// Sets the selected item.
        /// </summary>
        /// <param name="control">The base ProdUI control.</param>
        /// <param name="items">The items.</param>
        private static void UiaSetSelectedItems(BaseProdControl control, IEnumerable <string> items)
        {
            if (!UiaCanSelectMultiple(control))
            {
                throw new ProdOperationException("Does not support multiple selection");
            }
            Collection <object> logList = new Collection <object> {
                items
            };

            LogController.ReceiveLogMessage(new LogMessage("Adding", logList));
            foreach (string item in items)
            {
                SelectionItemPatternHelper.AddToSelection(control.UIAElement, item);
            }
        }