Select to view content in your preferred language

SL4 Breaks ESRI Behaviors

1857
13
04-26-2010 12:01 PM
PatrickBrooke
Emerging Contributor
Hello all,

Unless it is just me, which i sincerely hope it is, SL4 breaks the Measure Action and Constrained Extent Behavior. I will attach my constrained extent behavior code, but it is the same as the ESRI sample, a pretty basic feature. The same code works just great in SL3. Strange Error. Measure Action is much the same. I realize the ESRI tools for SL are developed on SL3, but am hoping to push my new site out in the next week or 2 in SL4. Mainly upgrading for the print functionality. Worth it!

The error message:

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

Code:

xmlns:esriBehaviors="clr-namespace:ESRI.ArcGIS.Client.Behaviors;assembly=ESRI.ArcGIS.Client.Behaviors"

<i:Interaction.Behaviors>
                <esriBehaviors:ConstrainExtentBehavior ConstrainedExtent="-120,30,-60,60" />
  </i:Interaction.Behaviors>
0 Kudos
13 Replies
KevinSesock
Emerging Contributor
Jennifer:

None, at the moment, since I just realized my stupidity. Placed the code in the wrong spot (wasn't in esri:map).

Would be best for all of you to ignore my messages from here on out. 🙂
0 Kudos
MatthewStarr
Deactivated User
Hi Kevin,

What issues are you having with ShowCoordinatesBehavior?



I cannot seem to use

<i:Interaction.Behaviors>
       <esri:ConstrainExtentBehavior ConstrainedExtent="-9161000 4875000 -7532000 5779000"/>
</i:Interaction.Behaviors>

...  My base map is in web Mercator
0 Kudos
JenniferNery
Esri Regular Contributor
It works for me. I tried the following where my map is in 102100 Spatial Reference.

 <esri:Map x:Name="MyMap" ExtentChanged="MyMap_ExtentChanged">
  <esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
   <i:Interaction.Behaviors>
    <esri:ConstrainExtentBehavior ConstrainedExtent="-4814883.48538718,-5216317.8461096,9656548.66851654,5273956.71733734" />
   </i:Interaction.Behaviors>
 </esri:Map>


The only thing I see in your code that may be the problem is:

<i:Interaction.Behaviors> 
<esri:ConstrainExtentBehavior   ConstrainedExtent="-9161000 4875000 -7532000 5779000"/
</i:Interaction.Behaviors> 


The Extent is not delimited by comma. This will lead to XamlParseException.
0 Kudos
BrentStevener
Deactivated User
This error happens when you don't have a reference to ESRI.ArcGIS.Client.Behaviors in your project. Add the reference and you should be able to add it without the error. [I had the same problem and fixed it earlier]
0 Kudos