|
POST
|
Hi Kirk, I tried to debug your code:
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox Content="{Binding Label}"
IsChecked="{Binding IsEnabled, Mode=TwoWay}"
IsEnabled="{Binding IsInScaleRange}">
</CheckBox>
<Button Content="Select">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<esriBehaviors:SpatialQueryAction
DrawMode="Rectangle"
LayerID="MyGraphicsLayer"
Url="http://hq-gis-01/ArcGIS/rest/services/WaterInfrastructure2/MapServer/15"
Symbol="{StaticResource GraphicsLayerFillSymbol}"
TargetName="MyMap" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Slider Maximum="1" Value="{Binding Layer.Opacity, Mode=TwoWay}" Width="50" />
</StackPanel>
</DataTemplate>
and, as Jennifer mentionned, I confirm that the TargetName can't be resolved inside a datatemplate (and it's not a legend issue nor an ESRI issue). The TargetObject of the action is always null. In complement to the solution by code given by Jennifer, you might also create your own action which would initialize the Url and the map. Example of an action deriving fom SpatialQueryAction : public class LegendSpatialQueryAction : SpatialQueryAction
{
protected override void Invoke(object parameter)
{
var frameWorkElement = AssociatedObject as FrameworkElement;
var layerItem = (frameWorkElement == null ? null : frameWorkElement.DataContext as LayerItemViewModel);
var dynamicLayer = (layerItem == null ? null : layerItem.Layer as ArcGISDynamicMapServiceLayer);
var map = TargetObject as Map;
TargetObject = null; // reset in order to send OnTargetChanged
if (dynamicLayer != null && map != null)
{
if (layerItem.LayerType.Contains("MapLayer")) { } // TODO : decide what to do when action is called on map service layer item
Url = dynamicLayer.Url + "/" + layerItem.SubLayerID;
TargetObject = map;
base.Invoke(parameter);
}
}
} and you can use it in Layer template this way: <esri:Legend.LayerTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox Content="{Binding Label}"
IsChecked="{Binding IsEnabled, Mode=TwoWay}"
IsEnabled="{Binding IsInScaleRange}" VerticalAlignment="Center">
</CheckBox>
<Button Content="Select" Click="Button_Click" Margin="5,0">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click" >
<local:LegendSpatialQueryAction DrawMode="Rectangle" LayerID="MyGraphicsLayer"
TargetObject="{Binding ElementName=MyMap}"
Symbol="{StaticResource GraphicsLayerFillSymbol}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
</DataTemplate>
</esri:Legend.LayerTemplate> Note that the action should also initialize the symbol depending on the geometry type of the layer, but this is not done in my sample.
... View more
12-09-2010
08:09 AM
|
0
|
0
|
1041
|
|
POST
|
<esri:ArcGISDynamicMapServiceLayer ID="MyLOGISLayer" Url="http://gis.logis.org/arcgis/rest/services/SOMESERVER/MapServer/0"/> Due to the trailing '/0', http://gis.logis.org/arcgis/rest/services/SOMESERVER/MapServer/0 is not a map service end point but a feature layer end point. So it can't work. Try: <esri:ArcGISDynamicMapServiceLayer ID="MyLOGISLayer" Url="http://gis.logis.org/arcgis/rest/services/SOMESERVER/MapServer" /> Then if your service is not cached, you can set the property VisibleLayers to filter the visible layers.
... View more
12-09-2010
07:42 AM
|
0
|
0
|
1974
|
|
POST
|
You have to hook up an handler to the legend Refreshed event and in this handler you can add/remove/change any items in the legend tree (from a layerItem, you can get the LayerItems children and so on if it's a group layer)
... View more
12-09-2010
07:34 AM
|
0
|
0
|
2376
|
|
POST
|
You are right, the geometryType is not available in the LayerItemViewModel. That's mostly because the geometry type is not tied to a legend item but to the layer or sublayer itself (as an example, the GeometryType would have few sense for a GraphicsLayer that can contain any geometry type). That being said, I guess the target of your question is an ArcGISDynamicMapServiceLayer. From the LayerItemViewModel you can get the Layer and the subLayerID associated to the legend layer item. So your question becomes, how can I get the geometry type of an ArcGSDynamicMapServiceLayer sublayer. Answer is: - you cannot:( with out of the box method - but you can 🙂 by requesting by yourself the sublayer rest end point which is providing the info (e.g . http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Diversity_US_2D/MapServer//0)
... View more
12-09-2010
07:31 AM
|
0
|
0
|
1641
|
|
POST
|
You have to set the OffsetX and OffsetY properties of the symbol with the distance in pixels between the top left of the image and the pin of your symbol. Example coming from the interactive samples: <esri:PictureMarkerSymbol x:Key="PinPictureMarkerSymbol" OffsetX="11" OffsetY="39" Source="/Assets/images/i_pushpin.png" />
... View more
12-08-2010
06:47 AM
|
0
|
0
|
1802
|
|
POST
|
The cross domain policy file must be on the server providing the map service (not on your server), so in your case in 'http://gis.apfo.usda.gov'. If the map server has no cross domain file, you can use a proxy server and set the ProxyUrl property of your layer.
... View more
12-08-2010
04:27 AM
|
0
|
0
|
1955
|
|
POST
|
i also need to get into the sublayer of the service regardless of the effort needed ..... I have to clarify what I said in this thread because it could be confusing. If your data are dynamic either because the data are loaded by other applications or because you are filtering at the client side (using layerdefs), it's not possible to easily know the extent at the client side (this was the initial subject of this thread). Now if your data are static and that you can rely on the extent provided by the service, it's possible to get the extent of layer and sublayers at the client side: - for a layer, there is a 'FullExtent' property - for a sublayer, you can deserialize the info provided by the sublayer rest resource. For example, look at the extent info provided by this sublayer. Hope this help.
... View more
12-08-2010
04:11 AM
|
0
|
0
|
1683
|
|
POST
|
At this stage, it's difficult to guess where the issue is. I suggest a debugging scenario in 2 steps: 1) Look at error message returned by layer initialization a) hook up an handler to layer event 'InitializationFailed' by adding this in XAML: InitializationFailed="Layer_InitializationFailed" b) display the error with this code:
private void Layer_InitializationFailed(object sender, EventArgs e)
{
Layer layer = sender as Layer;
MessageBox.Show(layer.InitializationFailure.Message);
}
2) If then no idea about the problem, use an HTTP traffic sniffer such as fiddler to see the request your silverlight application is making. Note that, even if your application and your services are on the same server, you need a cross domain policy file if you are not using the same domain path (which is the case while debugging).
... View more
12-08-2010
03:55 AM
|
0
|
0
|
432
|
|
POST
|
You are right, it's a bug. Hopefully, it will be fixed in the next version. Sorry about that.
... View more
12-07-2010
08:22 AM
|
0
|
0
|
484
|
|
POST
|
You can do the same thing by code, even if the creation of DataTemplate is not straightforward with Silverlight (need to parse a string with XamlReader). Adding a column by code looks like: string attributeName = "GEOSCANREC";
DataTemplate cellTemplate = (DataTemplate)System.Windows.Markup.XamlReader.Load( @"<DataTemplate xmlns=""http://schemas.microsoft.com/client/2007"">
<HyperlinkButton NavigateUri=""{Binding Attributes[" + attributeName + @"], StringFormat='http://geopub.nrcan.gc.ca/html/view_e.php?id=\{0\}'}"" Content=""Click here"" TargetName=""_blank"" />
</DataTemplate>");
queryDetailsDataGrid.Columns.Add(new DataGridTemplateColumn() { Width = new DataGridLength(100), Header = "Hyperlink", CellTemplate = cellTemplate });
... View more
12-07-2010
08:03 AM
|
0
|
0
|
3207
|
|
POST
|
I don't know your context but it looks like you are trying to display HTML inside Silverlight. That's not that easy. If you stay inside Silverlight, you should use an 'HyperlinkButton' and set the NavigateUri property. Inside a datagrid, you can define a column like this:
<slData:DataGridTemplateColumn>
<slData:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<HyperlinkButton NavigateUri="{Binding Attributes[GEOSCANREC], StringFormat='http://geopub.nrcan.gc.ca/html/view_e.php?id=\{0\}'}" Content="Click here" TargetName="_blank" />
</DataTemplate>
</slData:DataGridTemplateColumn.CellTemplate>
</slData:DataGridTemplateColumn>
... View more
12-07-2010
07:12 AM
|
0
|
0
|
3207
|
|
POST
|
And what is the result of this request : http://gisserver/ArcGIS/rest/services/NetworkDS/NAServer
... View more
12-07-2010
06:49 AM
|
0
|
0
|
3361
|
|
POST
|
Could you share the result of the request on this URL : http://gisserver/ArcGIS/rest/services/NetworkDS/NAServer/Closest%20Facility ?
... View more
12-07-2010
06:27 AM
|
0
|
0
|
3361
|
|
POST
|
for class MapPoint, X property means latitude, and Y property means longitude? or is it the other way around? It's the other way : X means longitude and Y means latitude.
... View more
12-07-2010
06:20 AM
|
0
|
0
|
1128
|
|
POST
|
I viewed this page (link above) where the info for the World Topo is...I am not seeing on there where to determine of its an ArcGISDynamicMapServiceLayer or ArcGISTiledMapServiceLayer... If in the definition there are 'Tile infos' you can use both services else you can only use ArcGISDynamicMapServiceLayer. In you example, there are tiles, so you can use both (but ArcGISTiledMapServiceLayer recommended for taking advantage of the browser cache) Tile Info: Height: 256 Width: 256 DPI: 96 Levels of Detail: (# Levels: 20) Level ID: 0 [Start Tile, End Tile] Resolution: 156543.033928 Scale: 591657527.591555 .............
... View more
12-07-2010
06:13 AM
|
0
|
0
|
1083
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-12-2025 03:01 AM | |
| 1 | 10-14-2025 09:24 AM | |
| 1 | 06-13-2013 09:22 AM | |
| 1 | 04-29-2022 02:21 AM | |
| 1 | 04-29-2022 02:28 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-30-2025
08:06 AM
|