amwx / FluentAvalonia

Control library focused on fluent design and bringing more WinUI controls into Avalonia
MIT License
1.03k stars 97 forks source link

Inconsistent tooltip updates for NavigationView MenuItems with data binding #509

Closed Coloris closed 9 months ago

Coloris commented 10 months ago

Describe the bug When binding an observable collection to a hierarchical menu, the Tooltips for child menu items exhibit inconsistent behavior.

The Tooltips do not update correctly for the children menu items, displaying different behavior when the NavigationView is expanded or collapsed as shown in the bellow GIF

Screenshots

Desktop/Platform (please complete the following information):

Additional context

A minimal reproduction of the issue is available here : https://github.com/Coloris/FluentAvaloniaNavViewTooltipIssue

Is there a more efficient or recommended approach to achieve hierarchical menu binding ?

amwx commented 10 months ago

I wonder if this is an issue with ToolTips in Avalonia. Hierarchical NavView is nested ItemsRepeaters, and it looks like when the pane is expanded, we're getting the ToolTip from the top-level item for some reason rather than the lowest in the visual tree. I don't remember this occurring before either, but I can't remember how much I've tested tooltips. The fact that the header text and icons update mean the DataContext is correct,

Just testing with some nested containers:

<Panel ToolTip.Tip="Outer Panel"
       Background="White">
    <Grid Margin="100" 
          Background="Red"
          ToolTip.Tip="Inner Panel">
        <Button Content="hi"
                ToolTip.Tip="hello" />
    </Grid>
</Panel>

And there are some oddities with ToolTips going on - not closing, and I did get the wrong tooltip over the button at least once.

FA is still on Avalonia 11.0.4, but if you're sample project is on 11.0.6 and still having issues, I don't think this has been fixed - or if it has has not been released yet. Would be worth raising this issue upstream and see if its been caught/fixed or just put it on their radar.

Coloris commented 9 months ago

Thanks for your time, took your sample code and created an issue : https://github.com/AvaloniaUI/Avalonia/issues/14201

Edit : Someone created an issue in 2021 for the same behavior, so I don't expect Avalonia to fix it in the near future.

Should I close this issue here @amwx ?

amwx commented 9 months ago

Closing as issue upstream.