wpf中的System.Visibility问题 [英] System.Visibility Problem in wpf
本文介绍了wpf中的System.Visibility问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public Screen2 MyScreen2{ get; set; }
private void Button_Click(object sender, RoutedEventArgs e)
{
this.Visibility = System.Windows.Visibility.Collapsed;
this.MyScreen2.Visibility = System.Windows.Visibility.Visible;
}
i尝试这个,显示'System.NullReferenceException' => 对象引用没有设置为对象的实例。
这里MyScreen2显示为null,
给出一些想法如何解决它,提前谢谢
i try this, shows an 'System.NullReferenceException' => "Object reference not set to an instance of an object".
Here MyScreen2 shows null,
Give some idea's how to resolve it, thanks in advance
推荐答案
您正在尝试使用null的东西。这意味着您要么将其设置为null,要么从未初始化它。
我建议您逐步执行代码并找到null对象。
您应该检查MyScreen2
对象。
- Amy
You are trying to use something that is null. This means you either set it to null, or you never initialized it.
I would suggest you to step through the code and find the null object.
You should check yourMyScreen2
object.
--Amy
这篇关于wpf中的System.Visibility问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文