"Working" - Animation in ToggleButtons in ToolBar

2 posts, 0 answers
  1. Markus
    Markus avatar
    2 posts
    Member since:
    Mar 2018

    Posted 09 Jul 2018 Link to this post

    Hi Guys,


    is it somehow possible to override the "IsChecked" style of a RadToggleButton within the RadToolBar?
    I would like to have a "working"-spinner animation when a button is pressed.


    Thank you very much.

  2. Vicky
    Vicky avatar
    43 posts

    Posted 12 Jul 2018 Link to this post

    Hello Markus,

    It is possible to achieve the desired by you appearance, using ToolBarContainerStyleSelector.

    Most important thing for your case is that the toolbar has predefined styles for RadToggleButton. In order to customize the styles for any of the elements in the toolbar you need to override the ToolBarContainerStyleSelector of the corresponding one - in your case RadToolBar.

    You need to add a ContainerStyle targeting the specific control (RadToggleButton in your case as a TargetName property), add its predefined style and add/edit/override the properties you need. In your case, that would be the ControlTemplate's VisualStateManager groups, referring checked states.

    Please note that setting a style directly on an element in the toolbar is won't work because the selector will override it.

    Attached you can find a sample project I created for you, demonstrating how to style the RadToggleButton inside RadToolbar, using the above mentioned ToolBarContainerStyleSelector, as well as Implicit Styles.

    Please check it and let me know if it helps.

    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top