How to change button style

4 posts, 1 answers
  1. Randy Hompesch
    Randy Hompesch avatar
    70 posts
    Member since:
    Nov 2008

    Posted 18 Dec 2016 Link to this post

    Hi,

    I am using a dataform as a rowdetail editor in a gridview.

    I have a global resource for changing button colors (not radbuttons). It works great but if I apply that same style to radbuttons, I end up affecting things I don't mean to touch. All I want is change the colors of OK and Cancel button of the RadDataForm. Can someone share an example of how to do this. I've read somewhere that I need to change a template but I have no idea how or, for that matter, where these templates might be.

    Thanks ... Ed

     

  2. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    503 posts

    Posted 20 Dec 2016 Link to this post

    Hi Ed,

    Indeed, modifying the control template of the RadButtons within the RadDataForm would be the way to go here. Generally, the RadButton has different states( for example - the "Disabled" one) so if you need to apply the same background no matter what the state of the button is, you can remove the different VisualStates from the control template. This might lead to not very user-friendly appearance, though. I have attached a sample for your reference. You can use it as a guidance and modify it to achieve the exact behavior you aim at. 

    I hope it helps.

    Regards,
    Stefan Nenchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Randy Hompesch
    Randy Hompesch avatar
    70 posts
    Member since:
    Nov 2008

    Posted 26 Dec 2016 in reply to Stefan Nenchev Link to this post

    Hi, this is great. It got me out of the woods ... sort of. The only problem is that I have to apply this styling at the resource level of the form. This means I have to copy and paste for every form. Is there a way to add this to the app resources as a global resource that will only be set once?

    Thanks ... Ed

     

  4. Answer
    Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1201 posts

    Posted 26 Dec 2016 Link to this post

    Hi,

    You can try setting the custom resource dictionary through an attached behavior, which is applied with an implicit style for RadDataForm. I am attaching a modified version of the initial project that illustrates this approach.

    Regards,
    Ivan Ivanov
    Telerik by Progress
    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