Select to view content in your preferred language

Minor problem with Legend control

1042
5
12-02-2010 03:07 PM
ChrisNorth
Esri Contributor
Hi,

I downloaded v2.1 this afternoon, and just added the Legend control into my application.

At runtime, the legend control works great. But, when I try to view the Design of my XAML page, VS throws an "InvalidCastException". Details are...

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)

Like I said, the legend works fine at runtime. In the XAML editor, my XAML code is:

<Border Background="#77919191" BorderThickness="1" CornerRadius="5"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="20" Padding="5" BorderBrush="Black" >
<esri:Legend Map="{Binding ElementName=MyMap}"
LayerIDs="Businesses, Community Facilities, Education, Base Map Layer"
LayerItemsMode="Flat"
/>
</Border>

Curiously, the XAML editor underlines the "LayerIDs=.." tag, and the tooltip shows the same cast error.

Am I missing something?

Chris

PS - The control (at runtime) is fantastic by the way - nice job.
0 Kudos
5 Replies
DominiqueBroux
Esri Frequent Contributor
This is a VS2010 bug and unfortunately, we didn't find any workaround.
It only happens in design view of VS2010.

This is the same bug that VisibleLayers one : http://forums.arcgis.com/threads/18545-VisibleLayers-error
0 Kudos
ChrisNorth
Esri Contributor
OK.  Thanks for the prompt reply.
0 Kudos
OlegLukyanov
Occasional Contributor
This is a VS2010 bug and unfortunately, we didn't find any workaround.
It only happens in design view of VS2010.

This is the same bug that VisibleLayers one : http://forums.arcgis.com/threads/18545-VisibleLayers-error


Did you find any workaround for Legend control now? Is it possible to use it in 2.2 API?

Thanks
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Did you find any workaround for Legend control now?

We didn't find any workaround yet.


Is it possible to use it in 2.2 API?

Despite this error in the design view, your code will compile and run correctly.
0 Kudos
KevinMayo
Emerging Contributor
Grrrrr.... this line is breaking my intellisense in VS.
0 Kudos