首页 新闻 赞助 找找看

设计SL的界面,xaml编辑正常,设计界面错误,具体如下,求解答

0
悬赏园豆:5 [已解决问题] 解决于 2012-11-26 14:36

System.NullReferenceException
未将对象引用设置到对象的实例。
在 Microsoft.Windows.Design.Platform.SilverlightMetadataContext.SilverlightXamlExtensionImplementations.<GetXmlNamespaceCompatibilityMappings>d__8.MoveNext()
在 MS.Internal.Design.Metadata.ReflectionProjectNode.BuildSubsumption()
在 MS.Internal.Design.Metadata.ReflectionProjectNode.SubsumingNamespace(Identifier identifier)
在 MS.Internal.Design.Markup.XmlElement.BuildScope(PrefixScope parentScope, IParseContext context)
在 MS.Internal.Design.Markup.XmlElement.ConvertToXaml(XamlElement parent, PrefixScope parentScope, IParseContext context, IMarkupSourceProvider provider)
在 MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.FullParse(Boolean convertToXamlWithErrors)
在 MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.get_RootItem()
在 Microsoft.Windows.Design.DocumentModel.Trees.ModifiableDocumentTree.get_ModifiableRootItem()
在 Microsoft.Windows.Design.DocumentModel.MarkupDocumentManagerBase.get_LoadState()
在 MS.Internal.Host.PersistenceSubsystem.Load()
在 MS.Internal.Host.Designer.Load()
在 MS.Internal.Designer.VSDesigner.Load()
在 MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load()
在 MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view)
在 MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
在 MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
在 MS.Internal.Host.Isolation.IsolatedDesigner.Load()
在 MS.Internal.Designer.DesignerPane.LoadDesignerView()

MarcoRui的主页 MarcoRui | 初学一级 | 园豆:5
提问于:2012-09-03 14:20
< >
分享
最佳答案
0

看看你View的构造函数

使用System.ComponentModel.DesignerProperties.IsInDesignTool来判断是否是设计时上下文,然后return,写在InitializeComponent()后面

if (IsInDesignTool)
return;
收获园豆:5
zhangweiwen | 小虾三级 |园豆:904 | 2012-09-03 16:08
其他回答(3)
0

要么是你xaml确实有写的不对的地方,如果你确定你xaml没有语法错误,那么  清理 ,重新生成解决方案试试。

icyme | 园豆:77 (初学一级) | 2012-09-03 14:28

额……首先,可以确定以及肯定的是,xaml语法没有任何问题,在xaml编辑器中没有出现任何问题,在运行时也没有出现任何问题。清理并重新生成后,还是老样子……悲催啊……

支持(0) 反对(0) MarcoRui | 园豆:5 (初学一级) | 2012-09-03 15:00

@MarcoRui: 能重新生成成功,但是在编辑器里面无法正常显示这个xaml页面上的任何元素,只是提示“未将对象引用设置到对象的实例”。你用的SL什么版本?这问题是什么时候开始出现的?

支持(0) 反对(0) icyme | 园豆:77 (初学一级) | 2012-09-03 15:03

@izhangxu: windows7 vs2010 .net4.0 sl4.0 额…………不好意思,这个问题出现了一段时间了,只是一直没重视……  

支持(0) 反对(0) MarcoRui | 园豆:5 (初学一级) | 2012-09-03 15:10

@MarcoRui: 没重视?那你出现这个问题之后,还可以在vs里面设置xaml页面?

支持(0) 反对(0) icyme | 园豆:77 (初学一级) | 2012-09-03 15:12

@izhangxu: 所谓没重视就是当时前端都差不多了,小修小改的直接编辑xaml就可以了……

xaml编辑器一直都是好的,也从来没有任何错误提示,只有在视图界面会出现这个错误

支持(0) 反对(0) MarcoRui | 园豆:5 (初学一级) | 2012-09-03 15:16

@MarcoRui: 我说的就是这个意思,因为你那个视图界面不会正常显示,一直都是提示“未将对象引用设置到对象的实例”是吧。如果是我说的这样,我以前的解决办法是重装一下SL4.0

支持(0) 反对(0) icyme | 园豆:77 (初学一级) | 2012-09-03 15:18

@izhangxu: 不幸的是,我重装了vs2010,重装了SL4,重装了Blend,还是没用

支持(0) 反对(0) MarcoRui | 园豆:5 (初学一级) | 2012-09-03 15:38

@MarcoRui: 那你比我还悲剧。这样吧,你重装系统,然后重装vs2010,等到装SL4的时候,你找我,我发个SL4给你,80%能行。需要SL4请发我邮箱xiaoguosilverlight@outlook.com说明。

支持(0) 反对(0) icyme | 园豆:77 (初学一级) | 2012-09-03 15:41
0

在你的控制面板中把silverlight 等一些东西都删除,然后重新安装

chenping2008 | 园豆:9836 (大侠五级) | 2012-09-03 15:39
0

肯定是你引用的对象没有“无参构造函数”

中文代码 | 园豆:951 (小虾三级) | 2012-09-04 08:42
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册