A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

24 lines
576 B

using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.LogicalTree;
namespace Avalonia.Controls
{
public class FlyoutPresenter : ContentControl
{
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
var host = this.FindLogicalAncestorOfType<Popup>();
if (host != null)
{
host.IsOpen = false;
e.Handled = true;
}
}
base.OnKeyDown(e);
}
}
}