|
POST
|
If you wish to return all records, you can update your query's Where clause to "1=1". This is similar to performing the query outside of SL, through the browser like so: http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/LandusePlanning/MapServer/0/query?text=&geometry=&geometryType=esriGeometryPoint&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&objectIds=&where=1%3D1&time=&returnIdsOnly=false&returnGeometry=true&maxAllowableOffset=&outSR=&outFields=&f=html
... View more
09-29-2010
04:52 PM
|
0
|
0
|
722
|
|
POST
|
One way of achieving this is to create your own class MyLayerInfo with additional property IsVisible, using an ObservableCollection of this type as ItemsSource for your listbox, and adding a method that updates IsVisible property by checking dynamic layer's VisibleLayers. Xaml-code: (update ListBox)
<ListBox x:Name="SubLayerListBox" Margin="0,5,0,0"
Grid.Row="1">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Margin="2"
Name="DynamicLayerCalifornia"
Content="{Binding LayerInfo.Name}"
IsChecked="{Binding IsVisible}"
Tag="{Binding LayerInfo.ID}"
ClickMode="Press"
Click="CheckBox_Click" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Code-behind: (update ListBox' ItemsSource)
ObservableCollection<MyLayerInfo> MySubLayers = new ObservableCollection<MyLayerInfo>();
public SubLayerList()
{
InitializeComponent();
this.SubLayerListBox.ItemsSource = MySubLayers;
}
private void ArcGISDynamicMapServiceLayer_Initialized(object sender, EventArgs e)
{
ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer dynamicServiceLayer =
sender as ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer;
foreach (LayerInfo l in dynamicServiceLayer.Layers)
MySubLayers.Add(new MyLayerInfo(l));
if (dynamicServiceLayer.VisibleLayers == null)
dynamicServiceLayer.VisibleLayers = GetDefaultVisibleLayers(dynamicServiceLayer);
UpdateIsVisibleProperty(dynamicServiceLayer.VisibleLayers.ToList());
}
//TODO: call this method everytime dynamicServiceLayer.VisibleLayers is updated
private void UpdateIsVisibleProperty(List<int> visibleLayerList)
{
foreach (MyLayerInfo info in MySubLayers)
info.IsVisible = visibleLayerList.Contains(info.LayerInfo.ID);
}
public class MyLayerInfo : INotifyPropertyChanged
{
public MyLayerInfo(LayerInfo info)
{
LayerInfo = info;
}
private LayerInfo layerInfo;
public LayerInfo LayerInfo
{
get { return layerInfo; }
set
{
if (layerInfo != value)
{
layerInfo = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("LayerInfo"));
}
}
}
bool isVisible;
public bool IsVisible
{
get { return isVisible; }
set
{
if (isVisible != value)
{
isVisible = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("IsVisible"));
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
... View more
09-29-2010
02:25 PM
|
0
|
0
|
1266
|
|
POST
|
The Previous and Next Extents are not enabled until you actually change your map extent by panning/zooming. If you use the live sample, you can check that as soon as you pan/zoom, Previous extent becomes enabled and you can navigate between the previous and next extents. So, they both function, it is just that they are both initially disabled since there are no extents to navigate to just yet.
... View more
09-29-2010
11:58 AM
|
0
|
0
|
1817
|
|
POST
|
When you say you are unable to query your feature layer - does your query ever get completed? Can you also subscribe to failed event? Can you also check that the parameters you set when performing the query through the browser (outside SL) are the same parameters you set in your SL app?
queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
queryTask.Failed += QueryTask_Failed;
As far as limitation in the number of records returned by a service; the default is 500 for ArcGIS Server 9.3.1, 1000 for ArcGIS Server 10, 1000 for MapIt... as mentioned here:http://help.arcgis.com/en/webapi/silverlight/help/creating_featurelayer.htm
... View more
09-29-2010
11:49 AM
|
0
|
0
|
722
|
|
POST
|
I'm assuming you already looked at this sample for MeasureAction:http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#UtilityActions In addition to this sample, you can add the code I posted below. It is already in C#.
... View more
09-28-2010
05:46 PM
|
0
|
0
|
2339
|
|
POST
|
You must be referring to MeasureAction. The GraphicsLayer that contains the polygon used for Measure is added to the map once Measure is started and removed from the map once Measure has completed. If you need this polygon to stay in your map, you need to create your own GraphicsLayer and add a copy of this polygon to your GraphicsLayer. Maybe do something like the following: Note, however, that this code will be executed everytime a new layer is added to your map. You might need to tweak this to handle when you subscribe/unsubscribe to Graphics.CollectionChanged event. Xaml-code:
<esri:Map x:Name="MyMap">
<esri:ArcGISTiledMapServiceLayer ID="MyBaseLayer"
Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
<esri:GraphicsLayer ID="MyGraphicsLayer"/>
</esri:Map>
Code-behind:
this.MyMap.Layers.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Layers_CollectionChanged);
}
void Layers_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
{
foreach(var item in e.NewItems)
if(item is GraphicsLayer)
(item as GraphicsLayer).Graphics.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Graphics_CollectionChanged);
}
}
void Graphics_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
{
GraphicsLayer graphicsLayer = this.MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
if (graphicsLayer != null)
{
foreach (var item in e.NewItems)
{
if (item is Graphic)
{
Graphic g = item as Graphic;
graphicsLayer.Graphics.Add(new Graphic() { Geometry = g.Geometry, Symbol = g.Symbol });
}
}
}
}
}
... View more
09-28-2010
01:36 PM
|
0
|
0
|
2339
|
|
POST
|
Kindly refer to this forum post:http://forums.arcgis.com/threads/11131-Using-Templates-from-the-Template-Gallery
... View more
09-28-2010
06:37 AM
|
0
|
0
|
616
|
|
POST
|
In the SpatialQuery example, the query task is created and executed after MyDrawSurface_DrawComplete. If you would like to do the same in the LayerSelection example, you will need to tap into the Editor's EditCompleted event. You also may want to use FeatureDataGrid using featureLayer.SelectedGraphics as its FilterSource.
public MainPage()
{
InitializeComponent();
Editor editor = this.LayoutRoot.Resources["MyEditor"] as Editor;
if (editor!=null)
editor.EditCompleted += new EventHandler<Editor.EditEventArgs>(editor_EditCompleted);
}
void editor_EditCompleted(object sender, Editor.EditEventArgs e)
{
if (e.Action == Editor.EditAction.Select)
{
foreach (var edit in e.Edits)
{
if (edit.Layer is FeatureLayer)
{
FeatureLayer featureLayer = edit.Layer as FeatureLayer;
//TODO: display featureLayer.SelectedGraphics in a grid.
}
}
}
}
... View more
09-27-2010
10:38 AM
|
0
|
0
|
685
|
|
POST
|
Do you change your map cursor after GeoprocessorTask_GetResultDataCompleted? Or does it remain on System.Windows.Input.Cursors.Wait?
... View more
09-27-2010
10:17 AM
|
0
|
0
|
2890
|
|
POST
|
You can use the following code, where mapPoint is the point geometry you want to zoom to. MyMap.ZoomToResolution(MyMap.Resolution / MyMap.ZoomFactor, mapPoint);
... View more
09-27-2010
10:10 AM
|
0
|
0
|
3087
|
|
POST
|
Please look at Morten's response in this post:http://forums.arcgis.com/threads/13386-Changing-ArcGISTiledMapServiceLayer-(in-a-different-spatial-reference)-at-runtime
... View more
09-23-2010
02:59 AM
|
0
|
0
|
478
|
|
POST
|
You can use the 3rd parameter userToken of ProjectAsync like so: _geometryService.ProjectAsync(new List<Graphic>() { projectedGraphic }, new SpatialReference(4326), projectedGraphic); and in the Completed event, you can retrieve graphic with attributes through the UserState: void geometryService_ProjectCompleted(object sender, GraphicsEventArgs e) { Graphic projectedGraphic = e.UserState as Graphic; // TODO: complete project completed logic here. }
... View more
09-23-2010
02:50 AM
|
0
|
0
|
1245
|
|
POST
|
Thank you for your post. We just found out after reproducing your issue that we currently do not support editing vertices of an Envelope geometry (or Rectangle). However, this is something we might look into after 2.1.
... View more
09-22-2010
03:03 PM
|
0
|
0
|
1231
|
|
POST
|
There is no support for moving multiple graphics at once.
... View more
09-22-2010
02:47 PM
|
0
|
0
|
428
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a week 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 |
Monday
|