Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TrayIcon crashes when Binding The Icon #6733

Closed
FG-rgb opened this issue Oct 15, 2021 · 3 comments · Fixed by #8547
Closed

TrayIcon crashes when Binding The Icon #6733

FG-rgb opened this issue Oct 15, 2021 · 3 comments · Fixed by #8547

Comments

@FG-rgb
Copy link

FG-rgb commented Oct 15, 2021

Hello,

I creaded an DirectProperty in my App.axaml.cs of Type "WindowIcon".
This looks like:

`public static readonly DirectProperty<App, WindowIcon> CurrentTrayIconProperty =
AvaloniaProperty.RegisterDirect<App, WindowIcon>(nameof(CurrentStatus), o => o.CurrentTrayIcon, (o, v) => o.CurrentTrayIcon = v);

    public WindowIcon CurrentTrayIcon
    {
        get => _currentTrayIcon;
        private set => SetAndRaise(CurrentTrayIconProperty, ref _currentTrayIcon, value);
    }
    private WindowIcon _currentTrayIcon;`

In the App constructor i load the icon.

In my App.xaml I bind to this Property.
<TrayIcon Icon="{Binding Source={x:Static Application.Current},Path=CurrentTrayIcon,Mode=OneWay}" ToolTipText="Avalonia Tray Icon ToolTip">

When I run my Program I got the following Message:

image

I would expect that the program does not crash.

I also tried to use an IBitmap, but then the TrayIcon is only black...

  • OS: Windows 10 64 Bit
  • Avalonia Version 0.10.8
@FG-rgb FG-rgb added the bug label Oct 15, 2021
@FG-rgb
Copy link
Author

FG-rgb commented Jan 20, 2022

Please also have a look at #6802

@FG-rgb
Copy link
Author

FG-rgb commented Jun 22, 2022

In current version 0.10.15 the problem does not occurs anymore.

@maxkatz6
Copy link
Member

I also tried to use an IBitmap, but then the TrayIcon is only black...

Yes, "black icon" is a default empty icon. Type should be WindowIcon.

When I run my Program I got the following Message:

Fixing it now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants