Reputation: 3197
When I put a combobox in my WPF app, at runtime, when I click it, it rolls down the included items. After selection, it rolls the DropDown up again.
Is it possible to prevent the rolling animation from happening? Instead I'ld like to just have it open and closed immediately.
- Marc
Upvotes: 2
Views: 3243
Reputation: 5657
You can also create a custom ComboBox ala this answer; so you'd end up with something like this.
class ComboBoxNoAnimation : ComboBox
{
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
var popup = (Popup)Template.FindName("PART_Popup", this);
popup.PopupAnimation = PopupAnimation.None;
}
}
Upvotes: 1
Reputation: 5813
I don't think it's possible to simply disable the animation on the ComboBox as it stands. However, I believe the default ControlTemplate for the ComboBox implements the dropdown portion as a Popup. I'm guessing that it's using the Slide
PopupAnimation setting. If you're up for it, you can replace the ControlTemplate for the ComboBox and set the PopupAnimation on that Popup to None
or whatever setting you'd like.
Here's an example ComboBox ControlTemplate thanks to Microsoft.
Let me know if you need further assistance.
-- HTH, Dusty
Upvotes: 2