Windows Phone ApplicationBar BackgroundColor 属性样式 XamlParseException

编程入门 行业动态 更新时间:2024-10-28 15:34:42
本文介绍了Windows Phone ApplicationBar BackgroundColor 属性样式 XamlParseException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-25 15:25:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1119409.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:样式   属性   Phone   Windows   ApplicationBar

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!