我正在尝试在全景视图的代码中创建一个本地化的应用程序栏。这是我的代码:
// Helper function to build a localized ApplicationBar
private void BuildApplicationBar()
{
// Set the page's ApplicationBar to a new instance of ApplicationBar.
ApplicationBar = new ApplicationBar();
ApplicationBar.Mode = ApplicationBarMode.Minimized;
// Create a new button and set the text value to the localized string from AppResources.
ApplicationBarIconButton homeButton = new ApplicationBarIconButton(new Uri("/Images/icons_home.png", UriKind.Relative));
homeButton.Text = AppResources.HomeIcon;
ApplicationBar.Buttons.Add(homeButton);
homeButton.Click += new EventHandler(HomeButton_Click);
ApplicationBarIconButton searchButton = new ApplicationBarIconButton(new Uri("/Images/appbar.feature.search.rest.png", UriKind.Relative));
searchButton.Text = AppResources.SearchIcon;
ApplicationBar.Buttons.Add(searchButton);
searchButton.Click += new EventHandler(SearchButton_Click);
}
但是,它不会将我的 ApplicationBar 识别为属性。错误说:“Microsoft.Phone.Shell.ApplicationBar”是一种“类型”,但用作“变量”。知道为什么吗?非常感谢!
飞