Silverlight resource incompatibility with VS designer?

I have the following definition at the top of my 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>

Then later I use the AlignmentListViewSource as the ItemSource, which I associate with the ComboBox. Everything seems to work correctly, except that the designer does not like the AlignmentsVM resource. He complains like this:

[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()

I checked that the ServiceReferences.ClientConfig file is part of the SilverlightUI project and is marked as "Content".

AlignmentsViewModel calls the webservice constructor in it, but I'm sure this is a problem with the VS constructor, not the class. I can compile and run the project, and it works exactly the way I want it to be from cassini by filling in the combo box. it's just a VS constructor that doesn't work together.

- , , ServiceReferences.ClientConfig IS?

+3
1

Visual Studio Control . UserControl_Loaded, . () , .

static bool isInDesignMode;

// Check for design mode (the Visual Studio Designer is unable to find the AppSettings.xml)
bool isInDesignMode = DesignerProperties.GetIsInDesignMode(this);

string cultures = isInDesignMode ? "en,de" : ConfigurationManager.AppSettings["supportedCultures"];
+3

Source: https://habr.com/ru/post/1763193/


All Articles