4

アプリケーションに多くのページがあり、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 Property。どうしたの?

4

1 に答える 1

2

ApplicationBar プロパティはBinding、Silverlight コントロールではないため、あなたが試みている方法で使用またはスタイリングすることはできないと思います。wholeアプリケーションバーをリソースとして配置できますが。そのようです

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

コードビハインドからボタンを追加します。ただし、これが役立つシナリオには遭遇していません。

于 2011-11-26T17:02:07.343 に答える