简体   繁体   English

UWP NavigationView 在选择另一个项目时不会更新先前选择的项目的前景色

[英]UWP NavigationView Foreground colour for the previously selected items does not update when selecting another item

I've been setting up a NavigationView in the UWP project I'm currently working on.我一直在我目前正在处理的 UWP 项目中设置 NavigationView。 I changed the colours of the text using the correct keys.我使用正确的键更改了文本的颜色。 However, when invoking an item the item selected before the new selected item does not change colour.但是,在调用项目时,在新选定项目之前选择的项目不会改变颜色。 For this to happen, it has to be pointed over and exited.为此,必须将其指向并退出。 It also updates the colour when collapsing the menu.它还会在折叠菜单时更新颜色。

I am sure the selected item is updated when another item is invoked.我确信在调用另一个项目时会更新所选项目。 The old menuitems are unselected upon invoking a new item.在调用新项目时,旧的菜单项将被取消选择。

Any help is appreciated.任何帮助表示赞赏。

I am sure the selected item is updated when another item is invoked.我确信在调用另一个项目时会更新所选项目。 The old menuitems are unselected upon invoking a new item.在调用新项目时,旧的菜单项将被取消选择。

I have tested your code.我已经测试了你的代码。 I found you set the NavigationViewItemForegroundPointerOver same as NavigationViewItemForegroundSelected .我发现您将NavigationViewItemForegroundSelected设置为与NavigationViewItemForegroundPointerOver相同。 If we select next item but the cursor over previous item that will make previous item foreground colour does not update.如果我们 select 下一项,但 cursor 超过上一项,会使上一项前景色不更新。 For this scenario, you could modify NavigationViewItemForegroundPointerOver to White to solve this problem.对于这种情况,您可以将NavigationViewItemForegroundPointerOver修改为 White 以解决此问题。

<SolidColorBrush x:Key="NavigationViewItemForegroundPointerOver" Color="White" /> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM