Browse Source
Merge pull request #3857 from AvaloniaUI/feature/3845-combobox-event-passthrough
Added ComboBox.PopupClosedOverride.
pull/3861/head
Dariusz Komosiński
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
18 additions and
4 deletions
-
src/Avalonia.Controls/ComboBox.cs
|
|
|
@ -234,6 +234,23 @@ namespace Avalonia.Controls |
|
|
|
base.OnTemplateApplied(e); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Called when the ComboBox popup is closed, with the <see cref="PopupClosedEventArgs"/>
|
|
|
|
/// that caused the popup to close.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="e">The event args.</param>
|
|
|
|
/// <remarks>
|
|
|
|
/// This method can be overridden to control whether the event that caused the popup to close
|
|
|
|
/// is swallowed or passed through.
|
|
|
|
/// </remarks>
|
|
|
|
protected virtual void PopupClosedOverride(PopupClosedEventArgs e) |
|
|
|
{ |
|
|
|
if (e.CloseEvent is PointerEventArgs pointerEvent) |
|
|
|
{ |
|
|
|
pointerEvent.Handled = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
internal void ItemFocused(ComboBoxItem dropDownItem) |
|
|
|
{ |
|
|
|
if (IsDropDownOpen && dropDownItem.IsFocused && dropDownItem.IsArrangeValid) |
|
|
|
@ -247,10 +264,7 @@ namespace Avalonia.Controls |
|
|
|
_subscriptionsOnOpen?.Dispose(); |
|
|
|
_subscriptionsOnOpen = null; |
|
|
|
|
|
|
|
if (e.CloseEvent is PointerEventArgs pointerEvent) |
|
|
|
{ |
|
|
|
pointerEvent.Handled = true; |
|
|
|
} |
|
|
|
PopupClosedOverride(e); |
|
|
|
|
|
|
|
if (CanFocus(this)) |
|
|
|
{ |
|
|
|
|