Example #1
0
        public TagTextBox()
        {
            tagsAvailable = new List<String>();
            tags = new List<String>();

            lbSuggestions = new ListBox();
            lbSuggestions.Dock = DockStyle.Fill;
            lbSuggestions.Margin = Padding.Empty;
            lbSuggestions.Padding = Padding.Empty;
            lbSuggestions.GotFocus += new EventHandler(lbSuggestions_GotFocus);
            lbSuggestions.MouseClick += new MouseEventHandler(lbSuggestions_MouseClick);

            popup = new Popup(lbSuggestions);
            popup.TopLevel = true;
            popup.AutoClose = false;

            InitializeComponent();
        }
Example #2
0
        private void SetOwnerItem(Control control)
        {
            if (control == null)
            {
                return;
            }
            if (control is Popup)
            {
                Popup popupControl = control as Popup;
                ownerPopup = popupControl;
                ownerPopup.childPopup = this;
                OwnerItem = popupControl.Items[0];
                return;
            }
            else if (opener == null)
            {
                opener = control;
            }

            if (control.Parent != null)
            {
                SetOwnerItem(control.Parent);
            }
        }