Dears,In my map i am adding lot of graphics in a buttonclick.For Eg: When i click button 5 graphics with different long and lat is adding on map.Some times graphics collection is more than 5 ...Now i need to position my map based on this graphics.Now i can ee the graphics after i drag the map.when i click button i need the display of map with all added graphics and zoom should adjust accordingly.<esri:Map Grid.Row="3" Extent="-120, 20, -100, 40" Name="MyMap" Visibility="Visible" Background="Transparent" Margin="2,0" BorderThickness="1" BorderBrush="{StaticResource TitleBarGradient}"> <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" /> <esri:GraphicsLayer ID="MyGraphicsLayer"> <esri:GraphicsLayer.MapTip> <StackPanel Orientation="Vertical" Margin="10,10,10,10"> <TextBlock Text="{Binding [Name]}" Width="120" Height="20" TextAlignment="Center" FontWeight="SemiBold"/> </StackPanel> </esri:GraphicsLayer.MapTip> </esri:GraphicsLayer> </esri:Map>
. For recordcount = 0 To e.Result.Count - 1 'Dim geometry1 As New Point(csys, rsOman("lon"), rsOman("lat")) Dim Status As String = "" Dim EventId As Integer Dim colourstyle As String EventId = e.Result(recordcount).EEventID If EventId = 253 Then colourstyle = "GlobePictureSymbol_Blue" ElseIf EventId = 110 Then colourstyle = "GlobePictureSymbol_Green" ElseIf EventId = 108 Then colourstyle = "GlobePictureSymbol_Green" ElseIf EventId = 101 Then colourstyle = "GlobePictureSymbol_Red" ElseIf EventId = 142 Then colourstyle = "GlobePictureSymbol_Black" ElseIf EventId = 254 Then colourstyle = "GlobePictureSymbol_Gray" Else colourstyle = "GlobePictureSymbol_Black" End If Status = e.Result(recordcount).EEventName '************************* ''''''''''LOCATION FROM POI and Roaddata same connection not possible bfre close Dim procname As String = "" Dim location As String location = "" If e.Result(recordcount).EStreetAddress <> "NULL" And e.Result(recordcount).EStreetAddress <> "" Then location = e.Result(recordcount).ELocationName & ", STREET: " & e.Result(recordcount).EStreetAddress Else location = e.Result(recordcount).ELocationName & "" End If '''''''''''''''''''''''''' TxtLastUpd.Text = e.Result(recordcount).Edatedisplay Dim gpsNMEASentences As String = "$GPGGA,92204.9, " & e.Result(recordcount).ELat & ", N," & e.Result(recordcount).ELon & ", W, 1, 04, 2.4, 25.7, M,,,,*75" Dim gpsNMEASentenceArray() As String = gpsNMEASentences.Split(ControlChars.Lf) Dim gpsNMEASentence() As String = gpsNMEASentenceArray(0).Split(","c) Dim graphic As New Graphic() With { .Geometry = mercator.FromGeographic(New MapPoint(Convert.ToDouble(gpsNMEASentence(4)), Convert.ToDouble(gpsNMEASentence(2)))), .Symbol = TryCast(LayoutRoot.Resources(colourstyle), Symbol) } Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MyGraphicsLayer"), GraphicsLayer) graphicsLayer.Graphics.Clear() graphicsLayer.Graphics.Add(graphic) esriLogoImage.Visibility = Windows.Visibility.Collapsed MyMap.Visibility = Windows.Visibility.Visible MyMap.ZoomTo(graphicsLayer.FullExtent) Next