This is a migrated thread and some comments may be shown as answers.

How to change button style

3 Answers 175 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Randy Hompesch
Top achievements
Rank 1
Randy Hompesch asked on 18 Dec 2016, 02:19 PM

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

 

3 Answers, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 20 Dec 2016, 11:22 AM
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.
0
Randy Hompesch
Top achievements
Rank 1
answered on 26 Dec 2016, 11:37 AM

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

 

0
Accepted
Ivan Ivanov
Telerik team
answered on 26 Dec 2016, 12:15 PM
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.
Tags
DataForm
Asked by
Randy Hompesch
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Randy Hompesch
Top achievements
Rank 1
Ivan Ivanov
Telerik team
Share this question
or