Select to view content in your preferred language

The type 'esriBehaviors:ConstrainExtentBehavior' was not found.

387
1
06-29-2011 08:23 PM
lancechua
Emerging Contributor
hi guys, i am currently having this error


"The type 'esriBehaviors:ConstrainExtentBehavior' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. "

and with,

"'esriBehaviors' is an undeclared prefix. Line 31, position 18"

i have already added the interactivity reference and behavior reference but it still give me this error, can anyone help me with this? pasted below is my code




<UserControl x:Class="SilverlightApplication1.MainPage"
    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:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:esri="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"   
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400"
>

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.Resources>
            <esriSymbols:SimpleMarkerSymbol x:Name="RedMarkerSymbol" Color="Red" Size="12" Style="Circle" />
            <esriSymbols:SimpleFillSymbol x:Name="BufferSymbol" Fill="#66BB0000" BorderBrush="#88CC0000" BorderThickness="2"  />
            <esriSymbols:SimpleFillSymbol x:Name="ParcelSymbol" Fill="#440000FF" BorderBrush="Blue" BorderThickness="2"  />
        </Grid.Resources>

        <!--<esri:Map x:Name="MyMap" Background="White"   Extent="-122.692,45.5072,-122.6757,45.5148" >-->
            <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:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
                      Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />-->
                <esri:GraphicsLayer ID="MyGraphicsLayer" />
        
            </esri:Map.Layers>
            <i:Interaction.Behaviors>
                <esriBehaviors:ConstrainExtentBehavior ConstrainedExtent="-120,30,-60,60" />
            </i:Interaction.Behaviors>

        </esri:Map>

        <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,15,0" >
            <Rectangle Fill="#22000000" RadiusX="10" RadiusY="10" Margin="0,4,0,0" />
            <Rectangle Fill="#775C90B2" Stroke="Gray" RadiusX="10" RadiusY="10"  Margin="0,0,0,5" />
            <Rectangle Fill="#FFFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" />
            <TextBlock x:Name="InformationTextBlock"
                 Text="Click on map to set location. A buffer will used to display parcels within 100 feet of the location."
                 Width="200" Margin="30,20,30,25" HorizontalAlignment="Left" TextWrapping="Wrap" />
        </Grid>


    </Grid>
</UserControl>
0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor
"'esriBehaviors' is an undeclared prefix. Line 31, position 18"


First be sure you have added ESRI.ArcGIS.Client.Behaviors as a reference in your project.

Then you have to declare the prefix you are using :

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


As an easier alternative, you can use the generic esri prefix identified by an URI:
   xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
0 Kudos