using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Markup.Xaml; using Avalonia.Interactivity; namespace ControlCatalog.Pages { public class FlyoutsPage : UserControl { public FlyoutsPage() { InitializeComponent(); var afp = this.FindControl("AttachedFlyoutPanel"); if (afp != null) { afp.DoubleTapped += Afp_DoubleTapped; } SetXamlTexts(); } private void Afp_DoubleTapped(object sender, RoutedEventArgs e) { if (sender is Panel p) { FlyoutBase.ShowAttachedFlyout(p); } } private void InitializeComponent() { AvaloniaXamlLoader.Load(this); } private void SetXamlTexts() { var bfxt = this.FindControl("ButtonFlyoutXamlText"); bfxt.Text = ""; var mfxt = this.FindControl("MenuFlyoutXamlText"); mfxt.Text = ""; var afxt = this.FindControl("AttachedFlyoutXamlText"); afxt.Text = "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n\n In DoubleTapped handler:\n" + "FlyoutBase.ShowAttachedFlyout(AttachedFlyoutPanel);"; var sfxt = this.FindControl("SharedFlyoutXamlText"); sfxt.Text = "Declare a flyout in Resources:\n" + "\n" + " \n" + " \n" + " \n" + " \n" + " \n\n\n" + "Then attach the flyout where you want it:\n" + "