Select to view content in your preferred language

info window is not showing Content ArcGIS Silverlight

2506
5
11-05-2014 10:22 AM
AnandKirti
Deactivated User
0 Kudos
5 Replies
DominiqueBroux
Esri Frequent Contributor

I don't get in your code how HpmInfoWindow is defined. It looks strangly defined twice: once in XAML, once in code.

Also the map has not the same name in XAML and in code (HpmMap vs HpmEsriBaseMap).

0 Kudos
AnandKirti
Deactivated User

My Project is in Prism 4.2 & MVVM. I defined this infowindow in xaml & from map.xaml.cs Constructor I assigned it to my Property in this way.

public HpmsBaseEsriMap()

        {

            InitializeComponent();

            if (DesignerProperties.IsInDesignTool == false)

            {

                var dmv = ServiceLocator.Current.GetInstance<IHpmsBaseEsriMapViewModel>();

                dmv.HpmEditor = this.HpmsRoutesSelectionEditorNme;

                dmv.HpmMap = this.HpmEsriBaseMap;

                dmv.HpmInfoWindow = this.HpmInfoWindow;

                dmv.HpmMapTip = this.MyMapTip;

                dmv.BindingMap();

                DataContext = dmv;

            }

        }

0 Kudos
JenniferNery
Esri Regular Contributor

You can refer to the SDK sample for some guidance: ArcGIS API for Silverlight - Interactive Samples | ArcGIS for Developers

I believe the reason why you are not seeing content in InfoWindow is either binding fails or graphic attributes do not contain the same key.

Key elements in the SDK sample are:

The DataTemplate used for InfoWindow.ContentTemplate uses square brackets [] with attribute key.

                <TextBlock Text="{Binding [STATE_NAME]}" Foreground="Black" FontSize="12" />

Another thing, you have to note is that InfoWindow needs to bind to a map.

        <esri:InfoWindow x:Name="MyInfoWindow"

                         Map="{Binding ElementName=MyMap}"

                         ContentTemplate="{StaticResource MyFeatureLayerInfoWindowTemplate}"/>

To resolve this binding, InfoWindow.Content is set to graphic attributes.

          MyInfoWindow.Content = g.Attributes;

The graphic contains the same key for attributes because the FeatureLayer it belongs requests for the same OutFields

        <esri:FeatureLayer ID="MyFeatureLayer"                                Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5"

                               OutFields="STATE_NAME,POP2007" />

I'm not exactly sure how dmv object is used here but it also sets its DataContext with one of its properties as the HtmlInfoWindow. I suspect that somehow it's overriding the source for binding. You can check this during debug, before HtmlInfoWindow opens, check it's DataContext and Content. Also, check OutputWindow, it usually show warnings if binding fails. The method BindingMap is also unclear to me, but one thing to check is that InfoWindow.Map property is also properly set.

AnandKirti
Deactivated User

My Fields Are same I checked during Debug & Map Binding is also there Map="{Binding ElementName=HpmEsriBaseMap}" with the map.

dmv is my ViewModel where I have these properties. Actually I need Map Object InfoWindow, Editor to work with in my ViewModel so I assigned defiend xaml things to my ViewModel from constructor and used.

If there is any other good way to do please let me know. I did exactly same way defiend in link provided by you as I followed that only from start. But things are not working out.

even I assign a just a texbox datatemplate with No attributes still dont show the datatemplate in info just round ball with arrow comes over geometry

0 Kudos
AnandKirti
Deactivated User

Everything was right Except 1 thing.

My Map is insider a Dock Panel where I have a Grid so when I gave the same Column & Row which i Mentioned for Map to InfoWindow.I worked.

0 Kudos