【发布时间】:2011-04-08 03:02:59
【问题描述】:
我在 XAML 的顶部定义了以下内容:
<controls:ChildWindow
x:Class="MyProject.SilverlightUI.Views.CharacterGenerator"
xmlns:my="clr-namespace:MyProject.SilverlightUI.ViewModels"
>
<controls:ChildWindow.Resources>
<my:AlignmentsViewModel x:Key="AlignmentsVM" ></my:AlignmentsViewModel>
<CollectionViewSource x:Key="AlignmentListViewSource" Source="{Binding Path=Alignments, Source={StaticResource AlignmentsVM}}"></CollectionViewSource>
</controls:ChildWindow.Resources>
稍后我将 AlignmentListViewSource 用作绑定到 ComboBox 的 ItemSource。除了 Designer 不喜欢 AlignmentsVM 资源外,一切似乎都正常工作。它的抱怨是这样的:
[Xml_CannotFindFileInXapPackage]
Arguments: ServiceReferences.ClientConfig
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See [broken hyperlink]
at System.Xml.XmlXapResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
at System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup()
我确认 ServiceReferences.ClientConfig 文件是 SilverlightUI 项目的一部分,并被标记为“内容”。
AlignmentsViewModel 在它的构造函数中调用了一个 web 服务,但我很确定这是 VS 设计器的问题,而不是类的问题。我可以编译并运行该项目,它的运行方式与我希望它从 cassini 完全一样,填充组合框。只是 VS 设计师不合作。
谁能告诉我如何让设计者认识到 ServiceReferences.ClientConfig 可用这一事实?
【问题讨论】:
-
作为后续,我通过从我的代码中删除对 Web 服务的任何引用来确认此问题与 ServiceReferences.ClientConfig 有关。只有在 AlignmentsViewModel 的定义中某处发现 web 服务调用时,设计者才会抱怨。
标签: silverlight mvvm resources silverlight-4.0