private void createCarers()
{
foreach (Carer c in CarerManager.Carers.Values)
{
Button x = new Button
{
Content = c.name,
MinHeight = 50,
Tag = c,
Margin = new Thickness(0, 0, 0, 10)
};
x.Click += new RoutedEventHandler(carerClick);
carersPanel.Children.Add(x);
}
}
private void carerClick(object sender, RoutedEventArgs e)
{
System.Windows.Application.Current.Shutdown();
}
好的,所以在窗口初始化时会调用createCarers
。
为什么这不起作用?关机事情只是一个测试,但它不起作用。