-
-
Notifications
You must be signed in to change notification settings - Fork 948
TooltipText binding missing in NotifyIcon #1426
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The TooltipText binding in NotifyIcon is missing. The line 388 notifyIcon.TooltipText = e.NewValue as string ?? string.Empty; in Wpf.Ui.Tray.Controls.NotifyIcon is no need.
private static void OnTooltipTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is not NotifyIcon notifyIcon)
{
return;
}
notifyIcon.TooltipText = e.NewValue as string ?? string.Empty;
notifyIcon.internalNotifyIconManager.TooltipText = notifyIcon.TooltipText;
_ = notifyIcon.internalNotifyIconManager.ModifyToolTip();
}To Reproduce
After startup the window. Check the Real-time visualization tree and Real-time property Explorer. The BindingExpress in TooltipText is missing.
There is my code :
...
[ObservableProperty]
private IStringLocalizer<Translations> _localizer;
[RelayCommand]
private void Test()
{
var cultureInfo = CultureInfo.GetCultureInfo("en-US");
CultureInfo.CurrentCulture = cultureInfo;
CultureInfo.CurrentUICulture = cultureInfo;
OnPropertyChanged(nameof(Localizer));
} <ui:FluentWindow.Resources>
<ResourceDictionary>
<controls:BindingProxy x:Key="proxy" Data="{Binding}"/>
</ResourceDictionary>
</ui:FluentWindow.Resources>
...
<tray:NotifyIcon x:Name="NotifyIcon"
Grid.Row="0"
FocusOnLeftClick="True"
Icon="pack://application:,,,/Assets/wpfui-icon-256.png"
MenuOnRightClick="True"
TooltipText="{Binding Localizer[ApplicationTitle]}">
<tray:NotifyIcon.Menu>
<ContextMenu DataContext="{Binding Data, Source={StaticResource proxy}}">
<MenuItem Header="{Binding Localizer[Test]}" Command="{Binding TestCommand}"/>
<Separator/>
<MenuItem Header="{Binding Localizer[Exit]}" Command="{Binding ExitCommand}"/>
</ContextMenu>
</tray:NotifyIcon.Menu>
</tray:NotifyIcon>Expected behavior
The TooltipText should be with a BindingExpress
Screenshots
| Now | Should be |
|---|---|
![]() |
![]() |
OS version
Windows 11
.NET version
net8.0-windows
WPF-UI NuGet version
<PackageReference Include="WPF-UI.Tray" Version="4.0.2" />
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working

