Windows Phone ApplicationBar BackgroundColor 属性样式 XamlParseException

发布于 2024-12-18 12:11:55 字数 612 浏览 2 评论 0 原文

我的应用程序中有很多页面,我决定在 App.Resources 中创建一个全局 ApplicationBar 样式:

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

但是,当我尝试启动应用程序时,VS 给了我一个错误:

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

这不是真的 - ApplicationBar.BackgroundColor属性。有什么问题吗?

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>

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'.

This isn't true - ApplicationBar.BackgroundColor Property. What's the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

提笔落墨 2024-12-25 12:11:55

我相信,ApplicationBar 属性不能使用 Binding 或按照您尝试的方式设置样式,因为它不是 silverlight 控件。尽管您可以将整个 applicationbar 作为资源。就像这样

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

编辑:
或者,如果您希望更改应用程序栏颜色,您可以将其放入资源中。

<shell:ApplicationBar x:Key="MyAppBar" IsVisible="True" BackgroundColor="#006699">
</shell: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>

EDIT:
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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文