Browse Source

NativeMenuItem.Clicked -> Click.

And mark `Clicked` as obsolete. For consistency with `MenuItem.Click`.
pull/5090/head
Steven Kirk 5 years ago
parent
commit
5d4b56d042
  1. 16
      src/Avalonia.Controls/NativeMenuItem.cs
  2. 2
      src/Avalonia.Native/AvaloniaNativeMenuExporter.cs

16
src/Avalonia.Controls/NativeMenuItem.cs

@ -151,7 +151,7 @@ namespace Avalonia.Controls
IsEnabled = _command?.CanExecute(null) ?? true;
}
public bool HasClickHandlers => Clicked != null;
public bool HasClickHandlers => Click != null;
public ICommand Command
{
@ -182,11 +182,21 @@ namespace Avalonia.Controls
set { SetValue(CommandParameterProperty, value); }
}
public event EventHandler Clicked;
/// <summary>
/// Occurs when a <see cref="NativeMenuItem"/> is clicked.
/// </summary>
public event EventHandler Click;
[Obsolete("Use Click event.")]
public event EventHandler Clicked
{
add => Click += value;
remove => Click -= value;
}
void INativeMenuItemExporterEventsImplBridge.RaiseClicked()
{
Clicked?.Invoke(this, new EventArgs());
Click?.Invoke(this, new EventArgs());
if (Command?.CanExecute(CommandParameter) == true)
{

2
src/Avalonia.Native/AvaloniaNativeMenuExporter.cs

@ -60,7 +60,7 @@ namespace Avalonia.Native
Header = "About Avalonia",
};
aboutItem.Clicked += async (sender, e) =>
aboutItem.Click += async (sender, e) =>
{
var dialog = new AboutAvaloniaDialog();

Loading…
Cancel
Save