Im trying to create a ComboBox thats both editable and drops up instead of down. The menu should also open when pressing the up-arrow-key (down by default).
I have tried
The default ControlTemplate
is not for the IsEditable = true
variety, but the style contains a trigger that changes it when IsEditable is set:
<Style.Triggers>
<Trigger Property="IsEditable" Value="true">
<Setter Property="BorderBrush" Value="{StaticResource TextBoxBorder}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Padding" Value="3"/>
<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
</Trigger>
</Style.Triggers>
It changes it to another ControlTemplate
where the relevant part is the popup:
<Popup x:Name="PART_Popup"
AllowsTransparency="true"
Grid.ColumnSpan="2"
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"
Placement="Bottom">
...
</Popup>
I think you should just be able to change the Placement
property to Top
.