Select to view content in your preferred language

Can't find ESRI.ArcGIS.SilverlightMapApp / Actions

3994
5
06-08-2011 06:40 AM
DuncanRager
Deactivated User
Greetings,

I keep getting an error for the xaml lines:

xmlns:usercontrols="clr-namespace:ESRI.ArcGIS.SilverlightMapApp"
xmlns:actions="clr-namespace:ESRI.ArcGIS.SilverlightMapApp.Actions"


That says, "Undefined CLR Namespace". The "clr-namespace" URI refers to a namespace 'ESRI.ArcGIS.SilverlightMapApp' that is not included in the assembly.

I'm fairly new to Silverlight/VS2010, so I'm unsure what this means. This is a new Silverlight project... I compared the references I brought in with those from the template, and they look to be the same.

Any ideas?

Thanks,

DR
0 Kudos
5 Replies
dotMorten_esri
Esri Notable Contributor
Did you create a Silverlight Map Template, then later copied some of that code to a different project? You probably forgot to copy some of the controls and classes over that were in the project (judging from the namespace declaration these are not referencing separate assemblies, but referencing class within the project, since no assembly name is specified).
0 Kudos
DuncanRager
Deactivated User
Indeed, they refer to the classes created in the c sharp template. I think I did enough to correct for this... though I've tried to translate everything over to VB. My code appears below:

Mainpage.xaml
<UserControl x:Class="Test5.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:esri="http://schemas.esri.com/arcgis/client/2009"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:ei="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
    xmlns:UserControls="clr-namespace:ESRI.ArcGIS.SilverlightMapApp"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">

        <!--Map/Layers-->
        
        <esri:Map x:Name="MyMap" WrapAround="True" Extent="-8449438,5093446,-8136352,5276656">

            <!--ESRI Street Map-->
            <esri:ArcGISTiledMapServiceLayer ID="ESRI_Street" 
                Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />

            <!--Constrain the extent-->
            <i:Interaction.Behaviors>
                <esri:ConstrainExtentBehavior ConstrainedExtent="-8449438,5093446,-8136352,5276656" />
            </i:Interaction.Behaviors>

        </esri:Map>
        
        <!--Top Left Pop Up Menu-->
        <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10">
            <UserControls:CollapsiblePanel x:Name="MainMenu">
                
            </UserControls:CollapsiblePanel>
        </Grid>

    </Grid>
</UserControl>


CollapsiblePanel.xaml.vb
Imports Microsoft.VisualBasic
Imports System
Imports System.Net
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Imports System.Windows.Ink
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes
Imports System.Windows.Controls.Primitives
Imports ESRI.ArcGIS.Client
Imports ESRI.ArcGIS.Client.Map

Namespace ESRI.ArcGIS.SilverlightMapApp
    <TemplateVisualState(GroupName:="ViewStates", Name:="Collapsed")>
    <TemplateVisualState(GroupName:="ViewStates", Name:="Expanded")>
    Public Class CollapsiblePanel
        Inherits Control

        Public Sub New()
            Me.DefaultStyleKey = GetType(CollapsiblePanel)
        End Sub
#Region "Dependency Properties"

        Public Property IsExpanded()
            Get
                Return GetValue(IsExpandedProperty)
            End Get
            Set(value)
                SetValue(IsExpandedProperty, value)
            End Set
        End Property

        Public Shared IsExpandedProperty As DependencyProperty = _
            DependencyProperty.Register("IsExpanded", GetType(Boolean), GetType(CollapsiblePanel), _
                            New PropertyMetadata(True, New PropertyChangedCallback(AddressOf OnIsExapandedChanged)))

        Private Shared Sub OnIsExapandedChanged(ByVal sender As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
            TryCast(sender, CollapsiblePanel).ChangeVisualState(True)
        End Sub

#End Region

        Public Overrides Sub OnApplyTemplate()
            MyBase.OnApplyTemplate()
            ChangeVisualState(False)
        End Sub

        Private Sub ChangeVisualState(useTransitions As Boolean)
            If IsExpanded = True Then
                VisualStateManager.GoToState(Me, "Expanded", useTransitions)
            Else
                VisualStateManager.GoToState(Me, "Collapsed", useTransitions)
            End If
        End Sub
    End Class
End Namespace


CollapsiblePanel.xaml
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:local="clr-namespace:ESRI.ArcGIS.SilverlightMapApp">
    <Style TargetType="local:CollapsiblePanel">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:CollapsiblePanel">
                    <Grid x:Name="LayoutRoot" RenderTransformOrigin="{TemplateBinding RenderTransformOrigin}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="ViewStates">
                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <DoubleAnimation BeginTime="00:00:00" Duration="00:00:0.3" Storyboard.TargetName="CollapsiblePanelScale" Storyboard.TargetProperty="ScaleY" To="1" />
                                        <DoubleAnimation BeginTime="00:00:00" Duration="00:00:0.3" Storyboard.TargetName="CollapsiblePanelScale" Storyboard.TargetProperty="ScaleX" To="1" />
                                        <DoubleAnimation BeginTime="00:00:00" Duration="00:00:0.3" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Opacity" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Collapsed">
                                    <Storyboard>
                                        <DoubleAnimation BeginTime="00:00:00" Duration="00:00:0.2" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Opacity" To="0" />
                                        <DoubleAnimation BeginTime="00:00:00" Duration="00:00:0.2" Storyboard.TargetName="CollapsiblePanelScale" Storyboard.TargetProperty="ScaleY" To="0" />
                                        <DoubleAnimation BeginTime="00:00:00" Duration="00:00:0.2" Storyboard.TargetName="CollapsiblePanelScale" Storyboard.TargetProperty="ScaleX" To="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter x:Name="Content"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Content="{TemplateBinding Content}" 
                                Margin="{TemplateBinding Padding}" 
                                ContentTemplate="{TemplateBinding ContentTemplate}">
                        </ContentPresenter>
                        <Grid.RenderTransform>
                            <ScaleTransform x:Name="CollapsiblePanelScale" ScaleX="1" ScaleY="1" />
                        </Grid.RenderTransform>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>


Most of this is just copied over from the template, though I think that I changed all the values that needed to be changed. I keep getting this error when I try to build:

"Undefined CLR Namespace". The "clr-namespace" URI refers to a namespace 'ESRI.ArcGIS.SilverlightMapApp' that is not included in the assembly.


I know that there is nothing in the <UserControls:CollapsiblePanel>, but because the namespace can't be found, the object type couldn't be found either.

Thanks,

DR
0 Kudos
DuncanRager
Deactivated User
Solution: added the name of my project (test5) in front of my custom namespace.

xmlns:userControls="clr-namespace:Test5.ESRI.ArcGIS.SilverlightMapApp"


instead of:

xmlns:userControls="clr-namespace:ESRI.ArcGIS.SilverlightMapApp"
0 Kudos
YusufIrzan
Deactivated User
This is another solution,
Add Reference to your project and select "ESRI.ArcGIS.Client.WebMap".
It's works for me.
0 Kudos
AnatoliiTerentiev
Deactivated User

There is generic.xaml file In standart esri map application template as shown on the picture.

You have to move it to your project on the client side, after inserting the name of your project instead

of the name "ESRIStandardMapApplication1". It is not obvious action, but it is the solution.

generic file.png

0 Kudos