Browse Source

rename property.

pull/6560/head
Dan Walmsley 5 years ago
parent
commit
d6dd8238ec
  1. 4
      samples/ControlCatalog/App.xaml
  2. 1
      samples/ControlCatalog/App.xaml.cs
  3. 12
      src/Avalonia.Controls/TrayIcon.cs

4
samples/ControlCatalog/App.xaml

@ -27,7 +27,7 @@
</Style>
<StyleInclude Source="/SideBar.xaml" />
</Application.Styles>
<TrayIcon.TrayIcons>
<TrayIcon.Icons>
<TrayIcons>
<TrayIcon Icon="/Assets/test_icon.ico" ToolTipText="Avalonia Tray Icon ToolTip">
<NativeMenu.Menu>
@ -46,5 +46,5 @@
</NativeMenu.Menu>
</TrayIcon>
</TrayIcons>
</TrayIcon.TrayIcons>
</TrayIcon.Icons>
</Application>

1
samples/ControlCatalog/App.xaml.cs

@ -106,7 +106,6 @@ namespace ControlCatalog
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime)
{
desktopLifetime.MainWindow = new MainWindow();
desktopLifetime.ShutdownMode = ShutdownMode.OnExplicitShutdown;
}
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewLifetime)
singleViewLifetime.MainView = new MainView();

12
src/Avalonia.Controls/TrayIcon.cs

@ -33,7 +33,7 @@ namespace Avalonia.Controls
static TrayIcon ()
{
TrayIconsProperty.Changed.Subscribe(args =>
IconsProperty.Changed.Subscribe(args =>
{
if (args.Sender is Application application)
{
@ -65,8 +65,8 @@ namespace Avalonia.Controls
/// <summary>
/// Defines the <see cref="TrayIcons"/> attached property.
/// </summary>
public static readonly AttachedProperty<TrayIcons> TrayIconsProperty
= AvaloniaProperty.RegisterAttached<TrayIcon, Application, TrayIcons>("TrayIcons");
public static readonly AttachedProperty<TrayIcons> IconsProperty
= AvaloniaProperty.RegisterAttached<TrayIcon, Application, TrayIcons>("Icons");
/// <summary>
/// Defines the <see cref="Icon"/> property.
@ -86,9 +86,9 @@ namespace Avalonia.Controls
public static readonly StyledProperty<bool> IsVisibleProperty =
Visual.IsVisibleProperty.AddOwner<TrayIcon>();
public static void SetTrayIcons(AvaloniaObject o, TrayIcons trayIcons) => o.SetValue(TrayIconsProperty, trayIcons);
public static void SetIcons(AvaloniaObject o, TrayIcons trayIcons) => o.SetValue(IconsProperty, trayIcons);
public static TrayIcons GetTrayIcons(AvaloniaObject o) => o.GetValue(TrayIconsProperty);
public static TrayIcons GetIcons(AvaloniaObject o) => o.GetValue(IconsProperty);
/// <summary>
/// Gets or sets the icon of the TrayIcon.
@ -121,7 +121,7 @@ namespace Avalonia.Controls
private static void Lifetime_Exit(object sender, ControlledApplicationLifetimeExitEventArgs e)
{
var trayIcons = GetTrayIcons(Application.Current);
var trayIcons = GetIcons(Application.Current);
RemoveIcons(trayIcons);
}

Loading…
Cancel
Save