diff --git a/src/Avalonia.Controls/Flyouts/MenuFlyout.cs b/src/Avalonia.Controls/Flyouts/MenuFlyout.cs index a2ce93ee6d8..1e5f43cf41f 100644 --- a/src/Avalonia.Controls/Flyouts/MenuFlyout.cs +++ b/src/Avalonia.Controls/Flyouts/MenuFlyout.cs @@ -24,9 +24,8 @@ public MenuFlyout() /// /// Defines the property /// - public static readonly DirectProperty ItemTemplateProperty = - AvaloniaProperty.RegisterDirect(nameof(ItemTemplate), - x => x.ItemTemplate, (x, v) => x.ItemTemplate = v); + public static readonly StyledProperty ItemTemplateProperty = + AvaloniaProperty.Register(nameof(ItemTemplate)); /// /// Defines the property. @@ -59,8 +58,8 @@ public IEnumerable? ItemsSource /// public IDataTemplate? ItemTemplate { - get => _itemTemplate; - set => SetAndRaise(ItemTemplateProperty, ref _itemTemplate, value); + get => GetValue(ItemTemplateProperty); + set => SetValue(ItemTemplateProperty, value); } /// @@ -82,7 +81,6 @@ public ControlTheme? FlyoutPresenterTheme } private Classes? _classes; - private IDataTemplate? _itemTemplate; protected override Control CreatePresenter() {