Overlay WPF controls

Posted by sandy on Stack Overflow See other posts from Stack Overflow or by sandy
Published on 2010-05-10T08:21:31Z Indexed on 2010/05/10 8:24 UTC
Read the original article Hit count: 982

Filed under:


I've written an 'auto-suggest' textbox user control in WPF. It behaves a little bit like the 'To' list in Hotmail, allowing the user to enter a list of items, offering suggestions when it is able.

The main controls are a a text box, a wrap panel and a list box. The text box captures user input. The wrap panel contains the text box and shows previous entries. The list box is used to show suggestions. Most of the time, the list box is hidden.

I'm using multiple instances of my control in a stack panel.

My problem is that when the list box is shown, it is included in the measurement of the height of the control. This forces the following controls in the stack panel to be shifted down, as these pictures demonstrate:

alt text

alt text

I've tried overriding the measurement of my control so not to include the list box, but this just results in the list box not being visible.

What I want to do is make the list box overlay any subsequent controls in the stack panel, like a combo box's drop down would do. However, I really don't know how to do this. Any ideas?



© Stack Overflow or respective owner

Related posts about wpf

Related posts about user-control