AppThemeBinding not working

Hi,
Using latest Xamarin Forms 4.7.0.968.
SfButton.BackgroundColor="{AppThemeBinding Light={StaticResource PrimaryColorLight}, Dark={StaticResource PrimaryColorDark }}"
is not working.There is no way to change the BackgroundColor.

1st attempt

mainpage.xaml

<Grid Grid.Row="5"
                      Padding="20,0,20,0"
                      VerticalOptions="Start">
                    <sfbuttons:SfButton x:Name="ColorSelectionButton" 
                            Clicked="OnShowPopupClicked"
                            BorderColor="White"
                            ShowIcon="True"
                            BorderWidth="0"
                            WidthRequest="60"
                            HeightRequest="50"  
                            FontSize="18"
                             BackgroundColor="{AppThemeBinding Light={StaticResource PrimaryColorLight}, Dark={StaticResource PrimaryColorDark }}"
                            Text="{Binding SelectedColor.ColorName}" >
                    </sfbuttons:SfButton>

                </Grid>

app.xaml
<Color x:Key="PrimaryColorLight">White</Color>
<Color x:Key="PrimaryColorDark">Black</Color>

<syncTheme:SyncfusionThemeDictionary>
            <syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
                <syncTheme:DarkTheme/>
                      </syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
        </syncTheme:SyncfusionThemeDictionary>

2nd attempt

app.xaml

<Color x:Key="PrimaryColorLight">White</Color>
<Color x:Key="PrimaryColorDark">Black</Color>

<syncTheme:SyncfusionThemeDictionary>
            <syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
                <syncTheme:DarkTheme/>
                      </syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
        </syncTheme:SyncfusionThemeDictionary>

<Style x:Key="AppointmentEditorSfButtonStyle"
               TargetType="sfbuttons:SfButton">
            <Setter Property="BackgroundColor"
                    Value="{AppThemeBinding Light={StaticResource PrimaryColorLight}, Dark={StaticResource PrimaryColorDark}}" />
        </Style>

mainpage.xaml
<Grid Grid.Row="5"
                      Padding="20,0,20,0"
                      VerticalOptions="Start">
                    <sfbuttons:SfButton x:Name="ColorSelectionButton" 
                            Clicked="OnShowPopupClicked"
                            BorderColor="White"
                            ShowIcon="True"
                            BorderWidth="0"
                            WidthRequest="60"
                            HeightRequest="50"  
                            FontSize="18"
                                        Style="{StaticResource AppointmentEditorSfButtonStyle}"
                            Text="{Binding SelectedColor.ColorName}" >
                    </sfbuttons:SfButton>

                </Grid>

Neither of these two tries work.
Two Remarks
1. SfButton.BackgroundColor="Red" is working
2. When i remove the following code from app.xaml
     <syncTheme:SyncfusionThemeDictionary>
            <syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
                <syncTheme:DarkTheme/>
                      </syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
        </syncTheme:SyncfusionThemeDictionary>
both attempts are working.
Thank you


10 Replies 1 reply marked as answer

GE George June 23, 2020 12:28 PM UTC

I forgot to mention that i also tried
to set the BackgroundColor in code behind
ColorSelectionButton.SetOnAppTheme(BackgroundColorProperty, Color.WhiteSmoke, Color.DarkGray);
Its also not working


DD Devakumar Dhanapoosanam Syncfusion Team June 25, 2020 01:59 AM UTC

Hi George, 
 
Greetings from Syncfusion. 
 
Currently we are analyzing the reported query at our end and we will update you the details on June 25, 2020 EOD. 
 
Regards, 
Devakumar D 



DD Devakumar Dhanapoosanam Syncfusion Team June 25, 2020 06:37 PM UTC

Hi George, 
 
Still we need some more time to analyze the reported query at our end and we will update you the details on June 26, 2020. 
 
Regards,  
Devakumar D 



GE George June 25, 2020 07:49 PM UTC

Thank you for the update


DD Devakumar Dhanapoosanam Syncfusion Team June 28, 2020 06:04 PM UTC

Hi George, 
 
We are facing some difficulties at our end and need some more time to analyze the reported query and we will update you further details on or before June 30, 2020. Sorry for the delay. 
 
Regards, 
Devakumar D 



AS Anandraj Selvam Syncfusion Team June 30, 2020 02:26 PM UTC

Hi George,  
  
Thanks for the patience. 
  
We would like to let you know that our testing team ensured this with both the cases, but that is worked at our end. Please find the sample for your reference. 
  
  
Screenshot: 
 
 
 
Light 
Dark 
  

  Please revert us for further investigation.


Regards,  

Anand Raj S. 



GE George July 1, 2020 07:54 PM UTC

Thank you for the solution.
Its working BUT i am realy stuck.
On the same page i have also a SfSchedule and a SfTextInputLayout and they are not changing to Dark mode
when user switches device from light mode to dark mode.
Can you please help me out.
Please check attached demo.
If possible please make any changes to the demo.
Thank you


Attachment: Themes856992260_e91c14f6.rar


SJ Suyamburaja Jayakumar Syncfusion Team July 3, 2020 03:45 AM UTC

Hi George, 
 
Sorry for the delay.  
 
Currently we are working on the requirement and we will update the complete details on or before July 5, 2020. 
 
Regards, 
Suyamburaja J. 



SJ Suyamburaja Jayakumar Syncfusion Team July 5, 2020 05:54 PM UTC

Hi George,   
 
 
We are facing some difficulties in achieving your requirement and we need some more time to find a feasible solution for your requirement. Hence, we will update the complete details on July 6,2020. 
 
Regards, 
Suyamburaja J 



SJ Suyamburaja Jayakumar Syncfusion Team July 6, 2020 03:24 PM UTC

Hi George, 
 
Thanks for your patience.  
 
We would like to let you know that your requirement has been achieved by the below sample for your reference 
 
 
Screenshot: 
 
Dark theme 
 
 
Light Theme: 
 
 
Please let us know if you need any further assistance on this. 
 
Regards, 
Suyamburaja J. 


Marked as answer
Loader.
Up arrow icon