Windows Phone ApplicationBar BackgroundColor Property Property XamlParseException

I had many pages in my application and I decided to create a global ApplicationBar style in App.Resources:

<Style TargetType="shell:ApplicationBar"> <Setter Property="BackgroundColor" Value="#006699" /> </Style> 

However, when I tried to run the application, VS gave me an error:

 The property 'BackgroundColor' was not found in type 'Microsoft.Phone.Shell.ApplicationBar'. 

This is false - ApplicationBar.BackgroundColor Property . What is the problem?

+4
source share
1 answer

I believe that ApplicationBar properties cannot use Binding or style as you try, as this is not a silverlight control. Although you can put the whole application bar as a resource. In this way

 <shell:ApplicationBar x:Key="MyAppBar" IsVisible="True" BackgroundColor="#006699"> <shell:ApplicationBarIconButton IconUri="/Images/image.png" Text="image" IsEnabled="True"/> </shell:ApplicationBar> 

EDIT: Or you can just put this in a resource if you want to change the color of your application bar.

 <shell:ApplicationBar x:Key="MyAppBar" IsVisible="True" BackgroundColor="#006699"> </shell:ApplicationBar> 

And add the buttons from the code behind. although, I have not come across a scenario where this will help.

+2
source

Source: https://habr.com/ru/post/1383182/


All Articles