WPF控制可见性不起作用

时间:2013-10-25 23:35:37

标签: c# wpf

我有一个简单的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;
}

0 个答案:

没有答案