问题描述
限时送ChatGPT账号..我的应用程序中有很多页面,我决定在 App.Resources 中创建全局 ApplicationBar 样式:
I had a lot of pages in my application and I had decided to make a global ApplicationBar style in App.Resources:
<Style TargetType="shell:ApplicationBar">
<Setter Property="BackgroundColor" Value="#006699" />
</Style>
然而,当我尝试启动应用程序时,VS 给了我一个错误:
However, when I tried to start the app, VS gave me an error:
The property 'BackgroundColor' was not found in type 'Microsoft.Phone.Shell.ApplicationBar'.
这不是真的 - ApplicationBar.BackgroundColor 属性.有什么问题?
This isn't true - ApplicationBar.BackgroundColor Property. What's the problem?
推荐答案
我相信 ApplicationBar 属性不能使用 Binding
或您尝试的样式,因为它不是 Silverlight 控件.虽然你可以把整个
applicationbar 当作一个资源.像这样
I believe, ApplicationBar properties cannot use Binding
or styling the way you're trying, as it is not a silverlight control. Although you can put the whole
applicationbar as a resource. Like so
<shell:ApplicationBar x:Key="MyAppBar" IsVisible="True" BackgroundColor="#006699">
<shell:ApplicationBarIconButton IconUri="/Images/image.png" Text="image" IsEnabled="True"/>
</shell:ApplicationBar>
或者,如果您希望更改应用栏颜色,您可以将其放在资源中.
Or you could just put this in the resource if you want your application bar color to change.
<shell:ApplicationBar x:Key="MyAppBar" IsVisible="True" BackgroundColor="#006699">
</shell:ApplicationBar>
并从后面的代码中添加按钮.不过,我还没有遇到过这会有所帮助的情况.
And add buttons from code behind. although, I haven't come across a scenario where this would help.
这篇关于Windows Phone ApplicationBar BackgroundColor 属性样式 XamlParseException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论