Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a WPF Dropdown panel

I'd like to create a dropdown panel in WPF the acts like a ComboBox/Expander hybrid. I'm currently using an Expander but it pushes the the controls underneath it down when it expands.

I simply want it to act like a ComboBox and overlay it's dropdown. I've looked at using Popups but they don't move with the underlying window when it's moved.

So, I've concluded that the closest control to my needs is a ComboBox which allows me to put a Grid or StackPanel into its dropdown area.

Any ideas how to achieve this?

like image 779
Mitch Avatar asked Jan 27 '26 15:01

Mitch


1 Answers

I am not exactly sure what you want to do:

But the layout depends very much on the parent control. If your controls are in a Stackpanel all controls will be moved if a control expands or changes its size. If you use a Canvas you can align controls on top of each other.

Also Adorner are useful when you want overlay something above something else.

You can change the appearance of the ComboxBox and you can put a grid or anything else inside it. Have a closer look at ItemTemplate.

like image 185
TalkingCode Avatar answered Jan 29 '26 10:01

TalkingCode



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!