0
public MainPage()
{
InitializeComponent();
ApplicationBar = new ApplicationBar();
ApplicationBar.Opacity = 1.0;
ApplicationBar.IsVisible = true;
ApplicationBar.IsMenuEnabled = true;
ApplicationBar.BackgroundColor = System.Windows.Media.Colors.Transparent;
ApplicationBarIconButton add = new ApplicationBarIconButton();
add.IconUri = new Uri("Icons/appbar.add.rest.png", UriKind.Relative);
add.Text = "add a friend";
ApplicationBar.Buttons.Add(add);
add.Click += new EventHandler(add_Click); //ERROR
ApplicationBarIconButton list = new ApplicationBarIconButton();
list.IconUri = new Uri("icons/appbar.folder.rest.png",UriKind.Relative);
list.Text = "List";
ApplicationBar.Buttons.Add(list);
ApplicationBarIconButton about = new ApplicationBarIconButton();
about.IconUri = new Uri("icons/appbar.questionmark.rest.png",UriKind.Relative);
about.Text = "about";
ApplicationBar.Buttons.Add(about);
}存在爲什麼這個錯誤的原因 - 「add_Click」這個名字不會在目前情況下
這是一個詭計問題嗎?您沒有定義事件處理程序add_Click。 – Hogan
也許VS自動將它設爲上限 - 即'Add_Click()' – Hogan