iframe中显示WPF的问题
仙剑 2012-06-08 04:44:51 我想将WPF浏览器程序嵌入到网页的iframe,可是遇到个奇怪的问题
网页里有一个iframe,id,name都为"frm_main",直接在页面中iframe标签的src输入WPF的地址,比如:http://192.168.4.156/VCLogIMP/VCLogIMP.xbap
浏览网页可以正常显示WPF
可是我用 连接(<a>) 改变iframe的src时,就会报错
启动 URI: http://192.168.4.156/VCLogIMP/VCLogIMP.xbap
应用程序标识: http://192.168.4.156/VCLogIMP/VCLogIMP.xbap#VCLogIMP.xbap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3123e6883e5050a9, processorArchitecture=msil/VCLogIMP.exe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3123e6883e5050a9, processorArchitecture=msil, type=win32
System.InvalidOperationException: 无法使用 NaN 大小调用 UIElement.Measure(availableSize)。
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Primitives.PopupRoot.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Interop.HwndSource.SetLayoutSize()
在 System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
在 System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
......
我的网页内容如下:
<iframe id="frm_main" name="frm_main" width="100%" height="600" src=‘Login.aspx'
frameborder="0"></iframe>
<a href="http://192.168.4.156/VCLogIMP/VCLogIMP.xbap" target="frm_main" id="a_vclogimp">
如果将<iframe>的src直接写成"http://192.168.4.156/VCLogIMP/VCLogIMP.xbap" 浏览时可以显示WPF,
可是点连接<a> 就就报错了
另外,报错后点“重新启动”又能显示了
请大牛们帮我看看是怎么回事