Reputation: 177
Is it possible to make the silverlight combo-box "drop up" i.e. display the popup above the combo-box instead of bellow as per default?
Upvotes: 3
Views: 1731
Reputation: 5788
The first step is to define your own ComboBox Template, that contains the definition of the Popup. Edit a copy using Blend for example.
However, placing that Popup above is not an easy task as Silverlight Popups have no Placement
or PlacementTarget
properties like in WPF that would allow to display it above.
Luckily Kent Boogaart wrote an Attached Behavior that adds this capability and it is used like this:
<Popup b:PopupPlacement.PlacementTarget="{Binding ElementName=ContentPresenterBorder}">
<b:Popup.PreferredOrientations>
<b:PopupOrientationCollection>
<b:PopupOrientation Placement="Top" HorizontalAlignment="Center"/>
<b:PopupOrientation Placement="Bottom" HorizontalAlignment="Center"/>
<b:PopupOrientation Placement="Right" VerticalAlignment="Center"/>
<b:PopupOrientation Placement="Right" VerticalAlignment="TopCenter"/>
</b:PopupOrientationCollection>
</b:Popup.PreferredOrientations>
<!--Popup content with the ItemPresenter-->
</Popup>
Where ContentPresenterBorder
is the name of the container that holds the ToggleButton of the ComboBox.
Upvotes: 2