haha hoho

haha hoho

  • NA
  • 2
  • 6.4k

'ConstrainExtentBehavior' cannot be added to a collection or dictionary of type 'BehaviorCollection'

Jul 22 2011 1:54 AM

i am currently doing a silverlight c# application , following a sample code in the arcgis website, i added this code in the xaml page to add the constrainextent function. there is no other code in the xaml.cs page.

 <i:Interaction.Behaviors>                
<esriBehaviors:ConstrainExtentBehavior ConstrainedExtent="-120,30,-60,60" />
</i:Interaction.Behaviors>

however it gives me this error, A value of type 'ConstrainExtentBehavior' cannot be added to a collection or dictionary of type 'BehaviorCollection'.

could anyone help me to solve this? this is my xaml page if there is any code i need to add in , i am a beginner in this section and have posted questions before but cant get a working solution for this.

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   
xmlns
:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns
:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns
:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns
:esriSymbols="clr-namespace:ESRI.ArcGIS.Client.Symbols;assembly=ESRI.ArcGIS.Client"
xmlns
:esri="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"
xmlns
:esriBehaviors="clr- namespace:ESRI.ArcGIS.Client.Behaviors;assembly=ESRI.ArcGIS.Client.Behaviors"
xmlns
:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"

mc
:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"
>
<Grid x:Name="LayoutRoot" Background="White">

<esri:Map x:Name="MyMap" Background="White" >

<esri:Map.Layers>

<esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"

Url="http://www.onemap.sg/arcgis/rest/services/Basemap/MapServer"/>

<esri:GraphicsLayer ID="MyGraphicsLayer" />

</esri:Map.Layers>

<i:Interaction.Behaviors>
<esriBehaviors:ConstrainExtentBehavior ConstrainedExtent="-120,30,-60,60" /
>
</i:Interaction.Behaviors>
</
esri:Map>

</Grid>

</
UserControl>

Answers (1)