- Home
- Forum
- Xamarin.Forms
- Difficulty defining the sfButton control theme
Difficulty defining the sfButton control theme
Hello, I would like your help to understand how control themes work,
because I read the documentation and even downloaded some examples that I found on some threads here on the forum,
but I was unable to reproduce the desired effect.
For example:
I downloaded an example that customizes the SfChart theme. The example works perfectly, when I tried
using what the documentation says to apply about SfButton, did not have any effect.
Code used:
<ContentPage.Resources>
<syncTheme:SyncfusionThemeDictionary>
<syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
<ResourceDictionary>
<x:String x:Key="SfButtonTheme">CustomTheme</x:String>
<Color x:Key="SyncPrimaryColor">Black</Color>
<Color x:Key="SyncPrimaryForegroundColor">White</Color>
</ResourceDictionary>
</syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
</syncTheme:SyncfusionThemeDictionary>
</ContentPage.Resources>
<button:SfButton Text="Check"
VerticalOptions="Start"
/>
Another question I was left with was the reason for the documentation to mention that the common color keys of the initial controls like "Sync" like "SyncPrimary",
however in most of the examples I downloaded, the color keys do not have the prefix "Sync". Is the documentation wrong?
For the example above, I used both names and it didn't work.
SIGN IN To post a reply.
10 Replies
HM
Hemalatha Marikumar
Syncfusion Team
January 4, 2021 12:52 PM UTC
Hi Neilson de Souza Cabral,
Greetings from Syncfusion.
We have validated your reported problem “Provided custom theme color changes for SfButton doesn’t set” and we were able to reproduce the same. We have resolved it through sample level by adding below code snippet
|
<Application.Resources>
<syncTheme:SyncfusionThemeDictionary>
<syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
<buttons:SfButtonStyles />
<ResourceDictionary>
<x:String x:Key="SfButtonTheme">CustomTheme</x:String>
<Color x:Key="SyncPrimaryColor">green</Color>
<Color x:Key="SyncPrimaryForegroundColor">Yellow</Color>
</ResourceDictionary>
</syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
</syncTheme:SyncfusionThemeDictionary>
</Application.Resources> |
|
<button:SfButton Text="Check"
VerticalOptions="Start"
/> |
You can find the control’s key from below link; these keys are only used for theme color changes. For common control properties (background, foreground) may have ‘Sync’ prefix and most of the control specific properties are having its control name with its usage. To avoid the confusion, please use the below listed keys with respect of controls.
Regards,
Hemalatha M.
Hemalatha M.
ND
Neilson de Souza Cabral
January 5, 2021 01:21 AM UTC
Thank you Hemalatha,
Worked perfectly.
I leave here your suggestion to complement and as in this case, until you correct the documentation. I have seen here on the forum, many problem solutions, which could be in the documentation, which would save you a lot of work there.
Regards,
NEILSON
HM
Hemalatha Marikumar
Syncfusion Team
January 5, 2021 08:04 AM UTC
Hi Neilson de Souza Cabral,
Thanks for your feedback.
To make it useful for all, we have planned to address it in a common section by including this as KB. This KB will be published in Live on or before January 11, 2021.
Regards,
Hemalatha M.
Hemalatha M.
ND
Neilson de Souza Cabral
January 5, 2021 08:32 PM UTC
Very good.
Thanks.
HM
Hemalatha Marikumar
Syncfusion Team
January 6, 2021 09:36 AM UTC
Hi Neilson de Souza Cabral,
Most welcome. We will let you know once kb is published.
Regards,
Hemalatha M.
Hemalatha M.
YP
Yuvaraj Palanisamy
Syncfusion Team
January 11, 2021 01:36 PM UTC
Hi Neilson de Souza Cabral,
Due to some technical hurdles we are not publish the KB document today and we will publish the KB document on or before 19th January 2021.
Regards,
Yuvaraj
HM
Hemalatha Marikumar
Syncfusion Team
January 20, 2021 01:00 PM UTC
Hi Neilson de Souza Cabral,
Due to having some technical hurdles, we were unable to make it in live. Hence, we need some more time to publish it in live. Hence, we will update once it gets rolled out.
Regards,
Hemalatha M.
Hemalatha M.
HM
Hemalatha Marikumar
Syncfusion Team
January 22, 2021 11:41 AM UTC
Hi Neilson de Souza Cabral,
As promised, we have resolved that technical hurdles and published that KB in live.
Regards,
Hemalatha M.
Hemalatha M.
ND
Neilson de Souza Cabral
January 25, 2021 03:58 PM UTC
Thank you Hemalatha.
It was excellent.
YP
Yuvaraj Palanisamy
Syncfusion Team
January 26, 2021 04:54 AM UTC
Hi Neilson de Souza Cabral,
Thanks for your update.
Regards,
Yuvaraj.
SIGN IN To post a reply.
- 10 Replies
- 3 Participants
-
ND Neilson de Souza Cabral
- Jan 2, 2021 07:18 PM UTC
- Jan 26, 2021 04:54 AM UTC