My Visual Studio 2010 design breaks with the following XAML code:<esri:Legend Map="{Binding ElementName=MyMap}" LayerIDs="Points of Interest, United States" LayerItemsMode="Tree"/>In fact, it is the property "LayerIDs" which breaks it. This is the exception I get:Unable to cast object of type 'Microsoft.Expression.DesignModel.DocumentModel.DocumentPrimitiveNode' to type 'Microsoft.Expression.DesignModel.DocumentModel.DocumentCompositeNode'.
at Microsoft.Expression.DesignModel.InstanceBuilders.ArrayInstanceBuilder.InstantiateTargetType(IInstanceBuilderContext context, ViewNode viewNode)
at Microsoft.Expression.DesignModel.InstanceBuilders.ClrObjectInstanceBuilder.Instantiate(IInstanceBuilderContext context, ViewNode viewNode)
at Microsoft.Expression.DesignModel.Core.ViewNodeManager.Instantiate(ViewNode viewNode)
After doing some research, I found out that the "LayerIDs" property references an integer array, rather than a collection; referencing a strong typed integer collection solves the problem. Someone reported this bug (referencing an integer array) at the Microsoft site; the bug has been reported to this link:http://connect.microsoft.com/VisualStudio/feedback/details/655799/defining-a-property-that-references-an-integer-array-in-xaml-breaks-visual-studio-2010-design-viewThe workaround (setting the collection) is also posted here:http://connect.microsoft.com/VisualStudio/feedback/details/655799/defining-a-property-that-references-an-integer-array-in-xaml-breaks-visual-studio-2010-design-view#detailsHere "rex_hansen" (3/31/2011 at 3:51 PM) has been kind enough to post a project "ArrayXAMLDemo" to show how to construct the strong-typed collection to be referenced by a property similar to "LayerIDs". I really do not have access to the "LayerIDs" property original code to make the change; I do not know how to inherit from the "Legend" control to make the change on the derived control either. Please, if you know how a workaround, do let me know.Thanks!Hugo.