|
POST
|
We currently do not have SelectionChanged event, you can subscribe to MouseLeftButtonDown event on the container inside DataTemplate and get the LayerItemViewModel this way:
var layerItemViewModel= ((sender as StackPanel).DataContext as ESRI.ArcGIS.Client.Toolkit.Primitives.LayerItemViewModel);
... View more
12-08-2010
02:58 PM
|
0
|
0
|
1846
|
|
POST
|
You can still use SpatialQueryAction but put it outside the Legend's Template. Name the button that this action belongs to so you may retrieve and set the Trigger for this element (in Post# 4, 2nd code snippet). In your Legend Template, add a button or checkbox that will allow you to select sub layer of interest. In its click or checked event, set the SpatialQueryAction Url so that the next time it is performed it would be for the this sub layer (in Post# 4, 1st + 2nd code snippets). Url and Symbol properties should be updated depending on the selected sub layer and its geometry type.
... View more
12-08-2010
02:39 PM
|
0
|
0
|
1034
|
|
POST
|
Did you subscribe to FeatureDataGrid's SelectionChanged event? Sorry, had to ask. When you select a row, the event handler code should be hit. Place a breakpoint there to be sure. You do see rows of FDG populated, right?
<esri:FeatureDataGrid SelectionChanged=" FeatureDataGrid_SelectionChanged"
Map="{Binding ElementName=MyMap}"
GraphicsLayer="{Binding ElementName=MyMap, Path=Layers.[MySelectionGraphicsLayer]}" />
... View more
12-08-2010
01:19 PM
|
0
|
0
|
624
|
|
POST
|
If your FeatureDataGrid's GraphicsLayer is set to the same GraphicsLayer that contains the results of your Query. The graphics in both FeatureDataGrid and GraphicsLayer must contain this attribute. Are you saying that g.Attributes["PARCELID"] returns null? You can check also that g.Attributes.ContainsKey("PARCELID"), which it should if you set up FeatureDataGrid correctly. The code you posted in #7 need to change to this. PARCELIDPASS.Text = string.Format("The ParcelID passed is {0}", id);
... View more
12-08-2010
12:28 PM
|
0
|
0
|
2192
|
|
POST
|
How about a button that will enable Draw for SpatialQuery as in this example (http://help.arcgis.com/en/webapi/silverlight/2.1/samples/start.htm#SpatialQuery). The QueryTask URL will then come from the following values: string baseURL = (((sender as Button).DataContext as ESRI.ArcGIS.Client.Toolkit.Primitives.LayerItemViewModel).Layer as ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer).Url;
// "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer"
int id = ((sender as Button).DataContext as ESRI.ArcGIS.Client.Toolkit.Primitives.LayerItemViewModel).SubLayerID;
string url = string.Format("{0}/{1}", baseURL, id); //QueryTask URL when draw is complete Or maybe use these values to set SpatialQueryAction URL? You can get this SpatialQueryAction in code: var t = System.Windows.Interactivity.Interaction.GetTriggers(SpatialQueryBtn)[0];
var spatialQueryAction = t.Actions[0] as ESRI.ArcGIS.Client.Actions.SpatialQueryAction;
spatialQueryAction.Url = url; Also, note that the symbol you use will need to change based on the geometry type for that sublayer.
... View more
12-08-2010
11:52 AM
|
0
|
0
|
1034
|
|
POST
|
Why would you want to put behavior inside Legend's DataTemplate? Did you want RedLine action per individual layer? I'm not sure if this is what you want to do but TargetName will not be resolved at this level. Maybe what you need to do is put GraphicsActions next to the Legend control but not inside the Legend's Template?
... View more
12-08-2010
10:56 AM
|
0
|
0
|
1034
|
|
POST
|
If you go to visit the map service from your browser, get the field name with type "esriFieldTypeOID", make sure that this is part of your OutFields.
... View more
12-08-2010
10:27 AM
|
0
|
0
|
527
|
|
POST
|
If you are talking about Arrow Mouse Cursor, the position it reports is from the tip of the arrow.
... View more
12-08-2010
10:24 AM
|
0
|
0
|
1802
|
|
POST
|
Check that your map service (visit through web browser) for the Query contains "PARCELID" as one of its fields. This is case-sensitive.
... View more
12-08-2010
10:16 AM
|
0
|
0
|
2192
|
|
POST
|
Kindly look at this related thread: http://forums.arcgis.com/threads/15833-ShapeFiles-And-Text-files You can go to Advanced Search for "Shapefile" in ArcGIS API for Microsoft Silverlight/WPF forum, to get more related threads.
... View more
12-08-2010
08:03 AM
|
0
|
0
|
2217
|
|
POST
|
How about try to get one sample working first and then merge the other sample with it? 🙂 Get ShowMouseCoordinates working first and then replace the type of layer within it, with the ArcGISDynamicMapServiceLayer. When learning samples, it is important to know what to get from each sample: In ShowMouseCoordinates, the essential parts are: * Map that contains a layer * Map that subscribes to MouseMove event * MouseMove implementation where screen point are transformed to map points In ArcGIS Dynamic Layer, the essential part is: * Map that contains a specific type of layer Knowing these should guide you what to put in XAML and what to put in code-behind. You will be able to adjust the code in such a way that each sample does not lose the function they serve.
... View more
12-08-2010
07:59 AM
|
0
|
0
|
457
|
|
POST
|
What type of layer is "MySelectionGraphicsLayer"? If it is a FeatureLayer, per Ali's suggestion you can get the ObjectID field (which I assume is the same as your ParcelID, is that correct?), then you can use this attribute key: MySelectionGraphicsLayer.LayerInfo.ObjectIdField Otherwise, if it is a GraphicsLayer and you know the actual field name for ParcelID, then you can hardcode the attribute key, for example: "ParcelID" Also, I don't think you can assume e.AddedItems or e.RemovedItems to be an IEnumerable<Graphic>, this is not the case for FeatureDataGrid's SelectionChangedEventArgs.
string id = MySelectionGraphicsLayer.LayerInfo.ObjectIdField; //or "ParcelID"
var graphics = (sender as ESRI.ArcGIS.Client.Toolkit.FeatureDataGrid).SelectedGraphics;
foreach(var g in graphics)
{
// get id
var id = g.Attributes[id];
// TODO: retrieve outside data for this id
break;
}
... View more
12-07-2010
03:19 PM
|
0
|
0
|
2192
|
|
POST
|
As long as OutFields include the ObjectId field you should be fine, you don't need to force it to "*".
... View more
12-07-2010
01:58 PM
|
0
|
0
|
2287
|
|
POST
|
The reason it did not work before is because ObjectID field is missing and is only injected in the query if specified in OutFields or Update() is called for SelectionOnly mode. ReturnGeometry is already set to True for FeatureLayer regardless of the Mode. There is no public property in FeatureLayer that can change this property.
... View more
12-07-2010
12:58 PM
|
0
|
0
|
2287
|
|
POST
|
I'm sorry that I am also confused with what you are trying to achieve with your code. It seems that the only time the layer is in Snapshot mode is when you click the button, right? At which time, you call update(), once update is complete, you change the layer back to SelectionOnly mode. While switching modes, you also update Where clause. If you do not need to update Where clause then Update() does not need to be called. I think that it's better to have two FeatureLayers one for each mode to avoid confusion. The use case you described here is not supported and I am not sure what other issues you may encounter when toggling modes without calling Update(). If you wish to continue with your current code. A workaround is to also include ObjectID in your OutFields.
... View more
12-07-2010
12:50 PM
|
0
|
0
|
2287
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 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
|