Search code examples
microsoft-metrowindows-runtimewinrt-xamlwindows-store

AppBarButtonStyle works not reliable for ToggleButton controls


Although the comment of the AppBarButtonStyle of the StandardStyles.xaml-ResourceDictionary states, that it can be used for Buttons and ToggleButtons, it does not behave reliable for ToggleButton controls.

Applied to a ToggleButton, the Outline is missing, and in some occasions, the Unchecked-state will be rendered as Checked. Moreover, the style references an Element named "BackgroundCheckedGlyph" which is not defined and leads to debug-errors when used in an AppBar.

Has someone already found or built a working Style for Buttons and ToggleButtons?


Solution

  • I've found that if I set the VisualState of the ToggleButton manually then the style works just fine (after adding the missing TextBlock). Not sure why this works (or why it's not working to begin with...)

    See this post for more information.