[英]My ApplicationBar is not displayed
我使用“用于Windows Phone的Visual Studio Express 2012”为Windows Phone 8创建了一个应用程序。 我有一个要登录的第一页,当用户转到要添加ApplicationBar的带有4个ivotItems的数据透视后。 我创建了applicationBar,它很好地显示在我的设计中。 当我在模拟器或手机上启动应用程序时,该栏不会出现。
您有解决我问题的想法吗?
我已经制作了所有有关applicationBar的msdn教程。
非常感谢!
这是我的xaml代码:
<phone:PhoneApplicationPage
x:Class="DemoWP.Home"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,5,0,0">
<phone:Pivot Margin="0,0,0,0" Foreground="#3399cc">
<phone:PivotItem CacheMode="{x:Null}" Header="Accueil">
<Grid/>
</phone:PivotItem>
<phone:PivotItem CacheMode="{x:Null}" Header="Planning" >
<Grid/>
</phone:PivotItem>
<phone:PivotItem CacheMode="{x:Null}" Header="Site">
<Grid/>
</phone:PivotItem>
<phone:PivotItem CacheMode="{x:Null}" Header="Contact">
<Grid/>
</phone:PivotItem>
</phone:Pivot>
</Grid>
<!--LayoutRoot is the root grid where all page content is placed-->
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Opacity ="1.0" BackgroundColor="#3399cc" Mode="Default">
<shell:ApplicationBarIconButton IconUri="/Images/feature.settings.png" Click="Settings_Click" Text="Paramètres"/>
<shell:ApplicationBarIconButton IconUri="/Images/refresh.png" Click="Save_Click" Text="Actualiser"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Click="MenuItem1_Click" Text="Déconnexion"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>
还有我的C#代码(非常简单)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
namespace DemoWP
{
public partial class Home : PhoneApplicationPage
{
public Home()
{
InitializeComponent();
}
private void Save_Click(object sender, EventArgs e)
{
MessageBox.Show("Save button works!");
//Do work for your application here.
}
private void Settings_Click(object sender, EventArgs e)
{
MessageBox.Show("Settings button works!");
//Do work for your application here.
}
private void MenuItem1_Click(object sender, EventArgs e)
{
MessageBox.Show("Menu item 1 works!");
//Do work for your application here.
}
private void MenuItem2_Click(object sender, EventArgs e)
{
MessageBox.Show("Menu item 2 works!");
//Do work for your application here.
}
}
}
如果它仍然没有出现在您的模拟器中,则可能是VS 2012中的某种错误。我的建议是重建项目,然后尝试再次在模拟器上运行。 这样,您可以确定模拟器正在运行最新的XAP。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.