Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8460645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:39:54+00:00 2026-06-10T13:39:54+00:00

I have a usercontrol that has a textbox and a listbox, and it uses

  • 0

I have a usercontrol that has a textbox and a listbox, and it uses them to provides autocomplete functionality to the users.

However, I want the listbox to be drawn outside of the boundaries of the user control so that it doesn’t get cutoff when the listbox has to be drawn near the edge of the user control. Any tips on how to do that? Essentially I want a listbox floating outside the boundaries of its container control.

The only way I can think off is to pass a reference to an outside listbox to the user control on instantiation and then manipulate that listbox instead of having it inside the user control, but I dont like this approach. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:39:56+00:00Added an answer on June 10, 2026 at 1:39 pm

    Problem is, you can’t escape your container form bounds, but you can host your control somewhere else.

    Here’s what I got working by abusing the ToolstripDropDown class (I use it to display datepickers in a large enterprise application):

    /// <summary>
    /// PopupHelper
    /// </summary>
    public sealed class PopupHelper : IDisposable
    {
        private readonly Control m_control;
        private readonly ToolStripDropDown m_tsdd;
        private readonly Panel m_hostPanel; // workarround - some controls don't display correctly if they are hosted directly in ToolStripControlHost
    
        public PopupHelper(Control pControl)
        {
            m_hostPanel = new Panel();
            m_hostPanel.Padding = Padding.Empty;
            m_hostPanel.Margin = Padding.Empty;
            m_hostPanel.TabStop = false;
            m_hostPanel.BorderStyle = BorderStyle.None;
            m_hostPanel.BackColor = Color.Transparent;
    
            m_tsdd = new ToolStripDropDown();
            m_tsdd.CausesValidation = false;
    
            m_tsdd.Padding = Padding.Empty;
            m_tsdd.Margin = Padding.Empty;
            m_tsdd.Opacity = 0.9;
    
            m_control = pControl;
            m_control.CausesValidation = false;
            m_control.Resize += MControlResize;
    
            m_hostPanel.Controls.Add(m_control);
    
            m_tsdd.Padding = Padding.Empty;
            m_tsdd.Margin = Padding.Empty;
    
            m_tsdd.MinimumSize = m_tsdd.MaximumSize = m_tsdd.Size = pControl.Size;
    
            m_tsdd.Items.Add(new ToolStripControlHost(m_hostPanel));
        }
    
        private void ResizeWindow()
        {
            m_tsdd.MinimumSize = m_tsdd.MaximumSize = m_tsdd.Size = m_control.Size;
            m_hostPanel.MinimumSize = m_hostPanel.MaximumSize = m_hostPanel.Size = m_control.Size;
        }
    
        private void MControlResize(object sender, EventArgs e)
        {
            ResizeWindow();
        }
    
        /// <summary>
        /// Display the popup and keep the focus
        /// </summary>
        /// <param name="pParentControl"></param>
        public void Show(Control pParentControl)
        {
            if (pParentControl == null) return;
    
            // position the popup window
            var loc = pParentControl.PointToScreen(new Point(0, pParentControl.Height));
            m_tsdd.Show(loc);
            m_control.Focus();
        }
    
        public void Close()
        {
            m_tsdd.Close();
        }
    
        public void Dispose()
        {
            m_control.Resize -= MControlResize;
    
            m_tsdd.Dispose();
            m_hostPanel.Dispose();
        }
    }
    

    Usage:

        private PopupHelper m_popup;
        private void ShowPopup()
        {
            if (m_popup == null)
                m_popup = new PopupHelper(yourListControl);
    
            m_popup.Show(this);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an WPF usercontrol that has a TextBox. I set the text Underline
I have a custom login usercontrol that has a normal textbox and a passwordbox.
I have a UserControl called InputSensitiveTextBox that inherits from TextBox . It has a
I have a TabControl that has four tabs: <TabControl> <TabItem><TextBox/></TabItem> <TabItem><UserControl/></TabItem> <TabItem><Label/></TabItem> <TabItem><Image/></TabItem> </TabControl>
I have a UserControl that has a BaseClass object as a public member. Right
I have created a UserControl that has 3 panels. What I what to do
Suppose I have a UserControl whose DataContext is set to an object that has
I have an UserControl that contains a Button : <UserControl> <Button> </UserControl> I want
I have a UserControl that I want to add at runtime to my current
I have a UserControl that contains a TextBox. The TextBox.Text property is data-bound and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.