2012-08-16 18 views
0

我正在創建一個具有多個頁面的應用程序,其中一個應用程序是用戶控制頁面,其工作原理類似於彈出一個paranoma頁面。 如何在該用戶控制頁面上添加應用程序欄? 我一直在嘗試使用下面的代碼,但它不起作用。帶應用程序欄窗口的用戶控制頁面電話

>  <phone:ApplicationBar> 
>    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True"> 
>     <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/> 
>     <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/> 
>     <shell:ApplicationBar.MenuItems> 
>      <shell:ApplicationBarMenuItem Text="MenuItem 1"/> 
>      <shell:ApplicationBarMenuItem Text="MenuItem 2"/> 
>     </shell:ApplicationBar.MenuItems> 
>   </shell:ApplicationBar> 
>   </phone:ApplicationBar> 

,我得到一個錯誤信息說「標籤‘應用程序任務欄CLR的命名空間’中的XML命名空間中不存在‘:Microsoft.Phone.Controls;裝配= Microsoft.Phone’。」。

我歡迎任何想法。

在此先感謝。

回答

0

這裏是解決方案: 您在應用資源區定義它:

<Application.Resources> 

    <shell:ApplicationBar x:Key="GlobalAppBar" IsVisible="True" IsMenuEnabled="True"> 
     <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1" Click="Button1_Click" /> 
     <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2" Click="Button2_Click" /> 
     <shell:ApplicationBar.MenuItems> 
      <shell:ApplicationBarMenuItem Text="MenuItem 1" Click="MenuItem1_Click" /> 
      <shell:ApplicationBarMenuItem Text="MenuItem 2" Click="MenuItem2_Click" /> 
     </shell:ApplicationBar.MenuItems> 
    </shell:ApplicationBar> 

</Application.Resources> 

查看更多在這裏:http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394043(v=vs.105).aspx

相關問題