Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF ComboBox popup placement : Bottom and aligned to the right edge

Tags:

I'm trying to create a ComboBox with a non-standard dropdown alignment. Basically, I want the dropdown to be below the ComboBox, but aligned with the right edge of the ComboBox instead of the left edge.

What a normal ComboBox looks like, using PlacementMode="Bottom":

combo box aligned to the left

What I want:

combobox aligned to the right

I tried to play with the Popup.PlacementMode property in the template of my ComboBox, but none of the possible values seem to do what I want. Is there a simple way to do it, preferably in pure XAML?

like image 542
Thomas Levesque Avatar asked Mar 17 '11 14:03

Thomas Levesque


1 Answers

When I opened Expression Blend, I have come up with the solution within a few seconds:

<Popup Placement="Left" VerticalOffset="{TemplateBinding ActualHeight}"         HorizontalOffset="{TemplateBinding ActualWidth}" 

Sometimes this application is more useful than writing xaml by hands, but not so often. enter image description here

like image 191
vortexwolf Avatar answered Sep 18 '22 15:09

vortexwolf