WPF对象引用未设置为对象实例

时间:2012-09-19 04:03:24

标签: wpf nullreferenceexception

在Windows Presentation Foundation中,我在设计器中遇到错误:

<WindowsPresentation:GMapControl x:Name="MainMap" Zoom="13" MaxZoom="24" MinZoom="1" Margin="0,145,0,0" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="Auto" />

然而,程序运行得很好。我完全难过了。设计师也完美呈现。这只是错误列表中的错误。

1 个答案:

答案 0 :(得分:3)

好吧,已经找到了解决方案。

事实证明,令人惊讶的GMaps Control有一个错误,其中声明放大WPF XAML语法会引发NullReferenceException。删除此标记已修复此问题:

<WindowsPresentation:GMapControl x:Name="MainMap" CanDragMap="True"  MaxZoom="24" MinZoom="1"  Margin="0,145,0,0" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="Auto" />

我希望这可以帮助有同样问题的人。