0

I'm working on Windows Phone project, and troubles have found me as usual :) The application bar I'm trying to create doesn't show the specified image and text. When I do it on code it simply doesn't work as planned:

private void BuildLocalizedApplicationBar()
        {
            ApplicationBar = new ApplicationBar();
            ApplicationBarIconButton specialAppBar = new ApplicationBarIconButton();
            specialAppBar.IconUri = new Uri("/Assets/special.png", UriKind.Relative);
            specialAppBar.Text = "special";
            ApplicationBar.Buttons.Add(specialAppBar);
        }

And when I do it in XAML, it is displaying perfect at design time only:

<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Assets/special.png" Text="special"/>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

I guess I'm missing smth important, but don't know what exactly. Will appreciate any help :) Thank you in advance

4

1 に答える 1

1

「special.png」ファイルの Build Action プロパティを確認します。それは「コンテンツ」である必要があります。

于 2013-08-28T10:11:55.420 に答える