How to create own theme for Xamarin.Forms button
This article explains how to define own custom theme in Xamarin.Forms button. Beyond the dark and light theme, Syncfusion controls are allowed to define your own desired theme, you can get the complete information to define your own theme here. But mentioned approach in that link is only for the control, which is not having `SfBorder` control reference for its control implementation.
Here, SfButton has been taken for example and it has a limitation to define the custom theme. To get the custom theme changes in your control, added SfButtonStyles along with format, which is mentioned in that guidelines.
You can get the corresponding control’s customization key values from here.
[XAML]
… xmlns:syncTheme="clr-namespace:Syncfusion.XForms.Themes;assembly=Syncfusion.Core.XForms" xmlns:buttons="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms" … <Application.Resources> <syncTheme:SyncfusionThemeDictionary> <syncTheme:SyncfusionThemeDictionary.MergedDictionaries> <!--Declare your own control style--> <buttons:SfButtonStyles /> <ResourceDictionary> <x:String x:Key="SfButtonTheme">CustomTheme</x:String> <Color x:Key="SyncPrimaryColor">#ba49e6</Color> <Color x:Key="SyncPrimaryForegroundColor">#FFFFFF</Color> </ResourceDictionary> </syncTheme:SyncfusionThemeDictionary.MergedDictionaries> </syncTheme:SyncfusionThemeDictionary> </Application.Resources> …
[XAML]
… xmlns:buttons="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms" .. <StackLayout> <buttons:SfButton Text="MY OWN THEME" Margin="0,10,0,0" FontSize="18" FontAttributes="Bold" HorizontalOptions="Center" VerticalOptions="Center" /> </StackLayout> …
Output
See also
How to switch between light and dark theme in Xamarin.Forms
How to override the default light and dark theme color customization in Xamarin.Forms
What are the customization options available in Xamarin.Forms button
How to define your own desired view into Xamarin.Forms button