Describe the bug
If NavigationViewItem
visibility is Collapsed
at start and became visible when NavigationView
is disabled, the NavigationViewItem
is rendered as it was enabled.
Steps to reproduce the bug
Add NavigationView IsEnabled="False"
, with a NavigationViewItem Visibility="Collapsed"
. Set NavigationViewItem Visibility="Visible"
Expected behavior
I expected the item to be displayed with the disabled (light gray) foreground.
If you toggle again the NavigationView IsEnabled
property or NavigationViewItem Visibility
it worked as expected.
Screenshots
Result:
Expected:
NuGet package version:
Microsoft.UI.Xaml 2.1.19040
| Windows 10 version | Saw the problem? |
| :--------------------------------- | :-------------------- |
| Insider Build (xxxxx) | |
| October 2018 Update (17763) | Yes |
| April 2018 Update (17134) | |
| Fall Creators Update (16299) | |
| Creators Update (15063) | |
| Anniversary Update (14393) | |
| Device form factor | Saw the problem? |
| :-------------------- | :------------------- |
| Desktop | Yes |
| Mobile | |
| Xbox | |
| Surface Hub | |
| IoT | |
Additional context
Thanks for the report! Disabling NavigationView isn't something we've really designed for. This should work, maybe there's a bug in the VSM or template bindings that make it not work?
We would be happy for you to contribute a fix if you know what the issue is. :)
I'll try to find why it doesn't work.
I'm having a similar issue, maybe the same root cause, with WinUI 2.4. Setting IsEnabled on a NavigationViewItem doesn't always repaint with the disabled/light foreground correct. If I expand or collapse the NavigationView, it repaints the correct foreground/background color. My screenshots look similar to @Psykobal, but I'm not doing anything with Visibility on the NavigationViewItem -- they're all just static XAML NavigationViewItems, and I'm setting the IsEnabled property on them directly in the code-behind.
Is this the kind of thing that might get looked at for WinUI 2.5 by the team, or is the team not really focused on WinUI 2.* maintenance?
@pettys This issue appears to be fixed in the newest WInUI 2.5 preview builds. Can you confirm you are seeing that in your scenario as well?
@Psykobal This issue appears fixed in WinUI 2.4.2 (WinUI 2.4.0 seems likely as well though I can't test that version).
Yes! My particular issue is fixed in 2.5.0-prerelease.200708003. Thanks!!!
Thanks @Felix-Dev for verifying.
@Felix-Dev 2.4.2 doesn't work as expected (they all appear as disabled the first time) but with the 2.5.0-prerelease.200708003 it's better, thanks!
I still have an issue, if you select an item (collapsed at start) before it was drawn for the first time (but after the visibility changed), the selected indicator is missing.
I end up setting opacity = 0 at startup and then setting manually the visibility binding and opacity = 100 to fix both.
@Psykobal could you open a new bug on that issue so we can track it? :)
@StephenLPeters Done: https://github.com/microsoft/microsoft-ui-xaml/issues/2941, I made a simple project to reproduce it.