|
POST
|
Ah okay I think I get it now. The feature is not deleted but an attribute of it is set ("REMOVED" field gets a DateTime as string). This means two things: 1 - The save is for saving the attribute value change. Save works 🙂 2 - The feature is not expected to be removed from the map unless you change the Where property of the FeatureLayer. Maybe use the following where clause, because features that were not deleted will have this field null, right? Where="REMOVED is null"
... View more
01-11-2011
08:38 AM
|
0
|
0
|
1843
|
|
POST
|
What I would do, instead of adding individual attribute value to the ListBox is set the ListBox ItemsSource to the features returned in Query ExecuteCompleted event handler. imageList.ItemsSource= args.FeatureSet.Features In doing this, you know that the elements of your ListBox is a collection of features with Attributes. This will allow you to use the previous Binding statements you had where you access the Attribute by their key. Your ListBox.ItemTemplate DataTemplate could then include the following: <TextBlock Text="{Binding Feature.Attributes[CITYNAME], StringFormat=CityName: \{0\}'}" />
<TextBlock Text="{Binding Feature.Attributes[POPULATION], StringFormat=Population: \{0\}'}" /> The idea is know the type of the elements contained in your ListBox so that you can write the correct Binding statement to access these values. Since you were adding them as strings before, there was no need for "Feature.Attributes[FIELDNAME]" but if you will be adding the resulting features, this - "Feature.Attributes[FIELDNAME]" - is needed.
... View more
01-11-2011
07:33 AM
|
0
|
0
|
1321
|
|
POST
|
The ArcGISDynamicMapServiceLayer has Layers property, which gives you some information about the sublayers.http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer~Layers.html To get fields of each specific sublayer, you will need to perform a query on each sublayer with OutFields = "*", the query URL can be formed by appending the layer.Url and the sublayer.ID. Or use the query URL and parse the JSON to get "fields" value, similar approach as in the following thread except look at the sub layer's "fields" section http://forums.arcgis.com/threads/17362-how-to-query-map-knowing-map-layer-name-(not-id)
... View more
01-11-2011
06:11 AM
|
0
|
0
|
1258
|
|
POST
|
Can you subscribe to the layer's EndSaveEdits and SaveEditsFailed events to see if there had been any error saving the edit? Are you saying the delete and save succeeds but the feature remains in your map? All other funtions are working like they should except for one thing. I disabled the DeleteSelected button and replaced it with a method that flags a "REMOVED" field. The MXD for that map has a Definition Query that only allows features where REMOVED IS NULL. This method work fine, but when I hit the Save button, the feature is still there. When you replaced DeleteSelected button, how are you deleting the feature exactly if the method you replaced it with only flags "Removed" field? I just want to know how the Save button can be enabled if you are performing the delete another way. Maybe the edit that it saves is a change in the attribute and not the delete of the feature. Could you share some code on how you are performing the delete? When you query the layer in the browser, the feature is in fact deleted but the map does not reflect this change? Sorry I had more questions than answers 😛
... View more
01-11-2011
05:42 AM
|
0
|
0
|
1843
|
|
POST
|
Looking at your code, you were adding each PID as string to your ListBox in the Query ExecuteCompleted event handler. This means that you will also need to update the XAML-code. The following snippets from your code-behind and XAML-code do not match: imageList.Items.Add(resultFeature.Attributes("PID").ToString())
<TextBlock Foreground="White" Text="{Binding Feature.Attributes[ADDRESS], StringFormat='Address: \{0\}'}" />
The Binding statement here becomes incorrect since the ListBox no longer contains a property Feature with a dictionary of Attributes that has index "ADDRESS" anymore. To fix this, you can alter your code by adding resultFeature directly to your ListBox or changing the Binding statement in XAML to just Text="{Binding StringFormat='Address: \{0\}'}".
... View more
01-11-2011
05:36 AM
|
0
|
0
|
1321
|
|
POST
|
You would populate the ListBox items, the same way you would ItemsControl and DataGrid.
// Bind data grid to find results. Bind to the LastResult property which returns a list
// of FindResult instances. When LastResult is updated, the ItemsSource property on the
// will update.
Binding resultFeaturesBinding = new Binding("LastResult");
resultFeaturesBinding.Source = findTask;
imageList.SetBinding(ListBox.ItemsSourceProperty, resultFeaturesBinding);
Notice that the code above is the same code in post #2 for ItemsControl and in the SDK sample http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Find for DataGrid, with the exception on the text in red, where imageList is the name of your control and ListBox is the type of your control. To select the feature based on the ListBox selection, the symbol that you use for the feature can define SelectionStates as Morten pointed you to this sample http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#CustomSymbols, look at SelectRectangleMarkerSymbol where the outline of the rectangle changes from blue to red. In code-behind all that needed to happen is to call Select() or UnSelect() on the graphic. So in the ListBox's SelectionChanged event - you know that the SelectedItem is a graphic and can therefore call Select() or UnSelect() on it.
... View more
01-10-2011
07:56 PM
|
0
|
0
|
1321
|
|
POST
|
I think the issue is when the code MapToScreen() is executed. It needs to be run when the layers are drawn to your map. Try to execute it in the LayersInitialized handler.
public MainPage()
{
InitializeComponent();
this.MyMap.Layers.LayersInitialized += Layers_LayersInitialized;
}
bool allLayersDrawn = false;
void Layers_LayersInitialized(object sender, System.EventArgs args)
{
if (!allLayersDrawn)
{
GraphicsLayer l = this.MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
if (l != null)
{
MapPoint mapPoint = l.Graphics[0].Geometry.Extent.GetCenter();
Point screenPoint = this.MyMap.MapToScreen(mapPoint);
}
allLayersDrawn = true;
}
}
... View more
01-10-2011
02:35 PM
|
0
|
0
|
1661
|
|
POST
|
I don't see why you would get this error message. I found this related thread: http://forums.arcgis.com/threads/3323-SL4-Breaks-ESRI-Behaviors Can you try adding the behavior in code-behind? Both methods should work actually (XAML / code-behind).
... View more
01-10-2011
07:39 AM
|
0
|
0
|
1958
|
|
POST
|
Maybe the error is unrelated to "x:Uid" then. Have you tried the recreating SDK sample? Was the issue related to xaml namespace definition or referencing the correct assemblies? I think you just need to update this line. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" The type mismatch may be caused by this. Here's more information about the error you got: http://msdn.microsoft.com/en-us/library/bb546975(v=VS.100).aspx
... View more
01-10-2011
05:51 AM
|
0
|
0
|
1958
|
|
POST
|
How about...
MapPoint mapPoint = graphic.Extent.GetCenter();
Point screenPoint = MyMap.MapToScreen(mapPoint);
provided neither graphic nor its extent is null.
... View more
01-10-2011
05:37 AM
|
0
|
0
|
1661
|
|
POST
|
Here's some documentation on how you could use ServiceDirectory http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/servicesdirectory.html
... View more
01-09-2011
01:37 PM
|
0
|
0
|
1201
|
|
POST
|
MouseWheel zoom with respect to current mouse position is by design. If you need to zoom to center, you may call MyMap.ZoomToResolution http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Map~ZoomToResolution(Double,MapPoint).html. For example, the following code will zoom in around the center of the current extent.
MapPoint center = MyMap.Extent.GetCenter();
MyMap.ZoomToResolution(MyMap.Resolution/2, center );
... View more
01-09-2011
12:19 PM
|
0
|
0
|
593
|
|
POST
|
This is related thread: http://forums.arcgis.com/threads/18534-FlareClusterer-event-bug. Kindly use the suggested workaround in Post #2. We'll try to get this bug fixed for future releases.
... View more
01-09-2011
11:42 AM
|
0
|
0
|
463
|
|
POST
|
This is related thread: http://forums.arcgis.com/threads/18534-FlareClusterer-event-bug Kindly look at post #2. What is returned by FindGraphicsInHostCoordinates() is an IEnumerable<Graphic>, which are the individual nodes contained in the cluster. You can iterate through these nodes and get their attributes.
... View more
01-09-2011
11:40 AM
|
0
|
0
|
574
|
|
POST
|
I'm not sure what your calculation is trying to achieve but referring to your first post, to find out the position of a graphic, you can use mouse events on the layer. In this SDK example (Identify), MouseClick event is used and e.MapPoint gives the location using map coordinates. http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Identify In this SDK example (Mouse Coords), MouseMove event is used to get both MapPoint and ScreenPoint. http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#MouseCoords As Morten mentioned, it is possible to convert from one coordinate system to the other by calling MapToScreen or ScreenToMap.
... View more
01-08-2011
07:43 PM
|
0
|
0
|
1661
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 4 weeks ago | |
| 1 | 09-11-2025 01:30 PM | |
| 1 | 06-06-2025 10:14 AM | |
| 1 | 03-17-2025 09:47 AM | |
| 1 | 07-24-2024 07:32 AM |
| Online Status |
Offline
|
| Date Last Visited |
3 weeks ago
|