我有一个简单的switch子句,它应该显示/隐藏一些控件并调用一个方法。非常简单。 问题是没有任何反应。我是一名Web开发人员,也是WPF的新手。这就是为什么我无法理解为什么以下不起作用的原因:
switch (_state)
{
case "ask":
LabelAsk.Visibility = System.Windows.Visibility.Visible; //not working
LabelSync.Visibility = System.Windows.Visibility.Hidden; //not working
ButtonYes.Visibility = System.Windows.Visibility.Visible; //not working
ButtonNo.Visibility = System.Windows.Visibility.Visible; //not working
break;
case "sync":
LabelAsk.Visibility = System.Windows.Visibility.Hidden; //not working
LabelSync.Visibility = System.Windows.Visibility.Visible; //not working
ButtonYes.Visibility = System.Windows.Visibility.Hidden; //not working
ButtonNo.Visibility = System.Windows.Visibility.Hidden; //not working
ScanFolders();
this.Close();
break;
}