Search code examples
c#xamluwpwin-universal-appnavigationview

UWP Set NavigationView TogglePaneButton color


As you can see from the image, the TogglePaneButton has a distinct color from the remaining.

enter image description here

That's because I set it manually to WhiteSmoke (actually in my pushed code it's already gray) when it is in the LeftMinimal mode in its source code of VisualState Compact.

enter image description here

I thought I could change it back when pane is open by modifying its visual state like this:

<VisualState x:Name="Expanded">
    <VisualState.Setters>
        <Setter Target="RootSplitView.PaneBackground" Value="{ThemeResource MainNavigationViewBackground}" />
        <Setter Target="TogglePaneButton.Background" Value="{ThemeResource MainNavigationViewBackground}" />
    </VisualState.Setters>
</VisualState>

But it is not working. How can I achieve that?

The code has exceeded 30000 characters so I can only post the link:

https://github.com/SeakyLuo/SMPlayer/blob/master/SMPlayer/Dictionaries/MainNavigationView.xaml


Solution

  • I have found a very simple solution:

    Just make another TogglePaneButton and put it over the original one. Then let it work as the real one. Set its visibility to Collapsed when needed.