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.
ConstrainedExtent="-120,30,-60,60" />
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>
esri:Map>
</Grid>
UserControl>
Priya LingePosted Jul 22, 2011, 2:52 AM
Try this,
System.Windows.Interactivity.Behavior behavior = new ESRI.ArcGIS.Client.Behaviors.ConstrainExtentBehavior()
{
ConstrainedExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(-120,30,-60,60)
};
System.Windows.Interactivity.Interaction.GetBehaviors(Map).Add(behavior);
Please see the below link.
http://forums.arcgis.com/threads/3323-SL4-Breaks-ESRI-Behaviors
Hope this will help.
Thanks.