Select to view content in your preferred language

Map tip is not working all the time

427
1
02-27-2012 08:39 AM
ForamParikh
Regular Contributor
Hello everyone i am having trouble with map tip.

<esri:GraphicsLayer ID="gpoly"   MinimumResolution="0" MaximumResolution="10" >
                    <esri:GraphicsLayer.MapTip >
                        <Border  BorderBrush="DarkGray" CornerRadius="1" BorderThickness="10" Background="White" Margin="0" >
                            <StackPanel Orientation="Vertical">
                                <TextBlock Margin="0,0,0,0"   Text="{Binding [LOCNAME]}" FontWeight="Bold" FontSize="14"></TextBlock>
                                <TextBlock Margin="0,15,5,5">
                 <Run Text="No. of projects: "/>
                 <Run Text="{Binding [CNT]}" FontWeight="Bold"/>

                                </TextBlock>
                            </StackPanel>
                        </Border>
                    </esri:GraphicsLayer.MapTip>
                </esri:GraphicsLayer>

It is working fine all the time but whenever i do spacial search it s stop appearing in text search it is working fine.

Please let me know where i am making mistake here is code of that graphics

  if (graphic.Attributes["GIC4.DBO.PROJECT_LOCATION_POLY.Type"].ToString().ToUpper() == "P")
                    {
                     

                        gsearchpoint.Opacity = 1;
                        gsearch = new Graphic();
                        gsearch = fpoint.Graphics.FirstOrDefault(gtt => gtt.Attributes["LOCATION_ID"] != null && (int)gtt.Attributes["LOCATION_ID"] == int.Parse(graphic.Attributes["GIC4.DBO.PROJECT_LOCATION_POLY.LOCATION_ID"].ToString()));
                        gglseach = new Graphic();
                        if (gsearch != null)
                        {
                            gglseach.Geometry = gsearch.Geometry;
                            gglseach.Attributes.Add("LOCATION_ID", int.Parse(graphic.Attributes["GIC4.DBO.PROJECT_LOCATION_POLY.LOCATION_ID"].ToString()));

                            gglseach.Symbol = layoutroot.Resources["searchpoint"] as ESRI.ArcGIS.Client.Symbols.MarkerSymbol;
                            gsearchpoint.Graphics.Add(gglseach);
                        }
                    }
                    else
                    {
                      
                        gsearchline.Opacity = 1;
                        gsearch = new Graphic();
                        gsearch = fline.Graphics.FirstOrDefault(gtt => gtt.Attributes["LOCATION_ID"] != null && (int)gtt.Attributes["LOCATION_ID"] == int.Parse(graphic.Attributes["GIC4.DBO.PROJECT_LOCATION_POLY.LOCATION_ID"].ToString()));
                        gglseach = new Graphic();
                        if (gsearch != null)
                        {
                            gglseach.Geometry = gsearch.Geometry;
                            gglseach.Attributes.Add("LOCATION_ID", int.Parse(graphic.Attributes["GIC4.DBO.PROJECT_LOCATION_POLY.LOCATION_ID"].ToString()));

                            gglseach.Symbol = layoutroot.Resources["searchline"] as ESRI.ArcGIS.Client.Symbols.SimpleLineSymbol;
                            gsearchline.Graphics.Add(gglseach);
                        }
                    }
                   cnt = totalfeature.Features.Count(gtt => gtt.Attributes["GIC4.DBO.PROJECT_LOCATION_POLY.LOCATION_ID"] != null && (int)gtt.Attributes["GIC4.DBO.PROJECT_LOCATION_POLY.LOCATION_ID"] == int.Parse(graphic.Attributes["GIC4.DBO.PROJECT_LOCATION_POLY.LOCATION_ID"].ToString()));
                   gglseach.Attributes.Add("CNT", cnt);
                   gglseach.Attributes.Add("LOCNAME", graphic.Attributes["GIC4.DBO.LOCATION_INFO.LOC_NAME"].ToString().ToUpper());
                   gglseach.Attributes.Add("LOCADDRESS", graphic.Attributes["GIC4.DBO.LOCATION_INFO.LOC_ADDY"].ToString().ToUpper());
                   gglseach.Attributes.Add("LOCCITY", graphic.Attributes["GIC4.DBO.LOCATION_INFO.LOC_CITY"].ToString().ToUpper());
                   gglseach.Attributes.Add("LOCSTATE", graphic.Attributes["GIC4.DBO.LOCATION_INFO.LOC_STATE"].ToString().ToUpper());
                   gglseach.Attributes.Add("LOCZIP", graphic.Attributes["GIC4.DBO.LOCATION_INFO.LOC_ZIP"].ToString());

It is working fine if i am not updating my feature layer's geometry but it stop working if i update my feature layer's geometry.and feature layer is different than my graphical layer.

Please help,
Thanks
Foram
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
MapTip looks up graphic.Attributes. When do you add attributes? It should only be after then that the maptip will show values. Otherwise, Binding cannot resolve since attributes are empty.
0 Kudos