1
votes

in C# Windows Phone 8.1, I create an AppBarButton with this XAML code:

<AppBarButton x:Name="btnMore" Icon="More" Foreground="White"  IsEnabled="False" Label="More" Grid.Row="1" VerticalAlignment="Top" FontSize="18" Click="AppBarButton_Click" />

in the dark theme of the phone everything is fine:

enter image description here

but in the LIGHT theme, backcolor and font color are black:

enter image description here

I tried to set a Background and BorderBrush for this problem but nothing changes, still in Light Theme passage and circle is black (even when the button is enabled)

<AppBarButton x:Name="btnMore"  Icon="More" Foreground="White"  IsEnabled="False" Label="More" Grid.Row="1" VerticalAlignment="Top" FontSize="18" Click="AppBarButton_Click" Background="White" BorderBrush="White" />

how do I solve this?

2
take a look at this, however, it is a little over complicated, involves retemplating the AppBarButton.kennyzx

2 Answers

2
votes

Setting RequestedTheme="Dark" on your AppBarButton will force it to be white irregardless of the chosen theme.


Why are you setting Foreground="White" on the app bar button? The app bar button will automatically adjust its colors correctly depending on the light/dark theme chosen. It looks as if you have forced the page background color to black and the text foreground color to white, so when the app bar button changes its colors, it doesn't match the background anymore. If you want to force your app to use the dark theme only, then set RequestedTheme="Dark" on any of your Application, Page, or even AppBarButton (depending on what scope you want to affect).

0
votes

Your button is most likely inside a CommandBar. Go to the CommandBar and set its Foreground to whatever color you like. This should solve your problem. It has worked for me.