WP7在ApplicationBar中的动态图标 [英] WP7 Dynamic icons in ApplicationBar
本文介绍了WP7在ApplicationBar中的动态图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ApplicationBar中的动态图标
Dynamic icons in ApplicationBar
可以在ApplicationBar中使用从url加载动态图像的动态图标?
我试过这个:
It's possible to have dynamic icons in ApplicationBar with dynamic images loaded from url? I tried this:
xaml:
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="" Text="Button 1"/>
<shell:ApplicationBarIconButton IconUri="" Text="Button 2"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
cs:
var myIcon = ApplicationBar.Buttons[1] as ApplicationBarIconButton;
myIcon.IconUri = new Uri(iconImageUrl, UriKind.Absolute);
我收到错误:路径不能是绝对的。
I'm getting error: Path cannot be absolute.
推荐答案
Chri第二个参数为UriKind.Relative如果uri是相对的 - 看起来像这样:
Chage the second parametr to UriKind.Relative if the uri is relative - looks like this one:
"/Images/icon.png"
这篇关于WP7在ApplicationBar中的动态图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文