Styling Windows Phone 8.1/WinRT AppBarButton

你离开我真会死。 提交于 2019-12-10 11:07:04

问题


I'm currently looking to implement a CommandBar for a WinRT Windows Phone 8.1 app. Overall it is very straightforward but I am unable to style the control.

I have themed my app so that the accent colour has been changed to green. This works well for pretty much everywhere in the app (buttons, textblocks etc.) but not for the AppBarButton.

The brushes I'm overriding are SystemColorControlAccentBrush and PhoneAccentBrush but changing these does not make any difference to the colour of the AppBarButton when pressed:

Any idea what I'm doing wrong/can this colour be changed?


回答1:


Set the CommandBar's foreground and background colors.

The command bar on Windows Phone is system UI not app UI and does not allow customizing the colors of individual AppBarButtons. Their colors always come from the CommandBar's colors.




回答2:


try changing app bar button color

            <AppBarButton x:Uid="SendMessageButton" Icon="Send" Foreground="" Background=""  Command="{Binding SendMessageCommand}" IsEnabled="{Binding IsSendMessageButtonEnabled}"/>

or change in code behind

  AppBarButton app = new AppBarButton();
            app.Foreground="";
            app.Background="";


来源:https://stackoverflow.com/questions/30218464/styling-windows-phone-8-1-winrt-appbarbutton

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!