Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 设置窗口的MaxHeight时,使用棱柱区域时发现KeyNotFound异常_C#_Wpf_Prism - Fatal编程技术网

C# 设置窗口的MaxHeight时,使用棱柱区域时发现KeyNotFound异常

C# 设置窗口的MaxHeight时,使用棱柱区域时发现KeyNotFound异常,c#,wpf,prism,C#,Wpf,Prism,我在我的一个WPF应用程序中使用棱镜区域。只要我在其构造函数中设置了窗口的最大高度,如图所示 this.MaxHeight=SystemParameters.MaximizedPrimaryScreenHeight 然后是代码行 IRegion pageRegion=_regionManager.Regions[“PageLayout”] 开始抛出KeyNotFound异常,但当我注释掉设置MaxHeight的行时,一切又开始工作了 有没有解决这种奇怪行为的建议?我面临着几乎相同的问题。你能写一

我在我的一个WPF应用程序中使用棱镜区域。只要我在其构造函数中设置了窗口的最大高度,如图所示
this.MaxHeight=SystemParameters.MaximizedPrimaryScreenHeight
然后是代码行
IRegion pageRegion=_regionManager.Regions[“PageLayout”]
开始抛出KeyNotFound异常,但当我注释掉设置
MaxHeight
的行时,一切又开始工作了


有没有解决这种奇怪行为的建议?

我面临着几乎相同的问题。你能写一个语句吗?
IRegion pageRegion=\u regionManager.Regions[“PageLayout”]两次,看看会发生什么?在试一试中写第一个,什么都没发生!!!第二个语句的结果是一样的,在try块之外。嗯,它对我有效,这就是我问你的原因。你试过一些硬编码的值吗<代码>this.MaxHeight=400
即使是harcoded值也不起作用。已经试过了!!