|
POST
|
You might consider to use the legend control to get the symbols representing the sublayers. The legend control provides between 0 and many symbols for a sublayer (depending on the renderer). So the first question is 'which symbol do you want to associate to a sublayer?' If you decide to associate the first symbol and if you use a legend control in your application, you could initialize the sublayer symbol in the refreshed event:
private void MyLegend_Refreshed(object sender, ESRI.ArcGIS.Client.Toolkit.Legend.RefreshedEventArgs e)
{
if (e.LayerItem.LayerItems != null)
{
foreach (var sublayerItem in e.LayerItem.LayerItems)
{
if (sublayerItem.LegendItems != null && sublayerItem.LegendItems.Any()) // if there is a legend item
sublayerItem.ImageSource = sublayerItem.LegendItems.First().ImageSource; // set the image of the sublayer with the image of the first legenditem
}
}
}
Then you can display a listbox having its ItemsSource binded to a layer item of the legend ([0] = first map layer in this sample): <ListBox ItemsSource="{Binding LayerItems[0].LayerItems, ElementName=MyLegend}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding ImageSource}"/>
<TextBlock Text="{Binding Label}" VerticalAlignment="Center" Margin="2,0"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox> Likely there are many other ways to get this result, just my 2cts.
... View more
02-09-2011
07:07 AM
|
0
|
0
|
3645
|
|
POST
|
Could you test with the MapPrinting sample application just by adding your feature layer to the map? Is it working or are you experimenting the same issue? My code changes had no effect (positive or negative) which makes me think that this method (clonelayer) is not being called in my scenario. Is that possible based on my setup according to the readme file? Is the print dialog working well with other layer types? At this time, I can't figure out how it could work without cloning the layers. Try to set a breakpoint to CloneLayer and execute in debug mode.
... View more
02-09-2011
06:09 AM
|
0
|
0
|
1785
|
|
POST
|
I am assuming esri's FeatureDataForm can be templated similar to the standard silverlight dataform. Is this correct? Sure. The easiest way is to use Blend : create a featuredataform, right-click, edit template, edit a copy, .... If you don't own Blend, I give you the default template:
<Style x:Key="FeatureDataFormStyle1" TargetType="esri:FeatureDataForm">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFF3F7FA" Offset="0"/>
<GradientStop Color="#FFFFFFFF" Offset="0.1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFA3AEB9" Offset="0"/>
<GradientStop Color="#FF8399A9" Offset="0.375"/>
<GradientStop Color="#FF718597" Offset="0.375"/>
<GradientStop Color="#FF617584" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="esri:FeatureDataForm">
<Border x:Name="DataFormBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="2">
<Border.Resources>
<Style x:Key="CustomScrollViewerStyle" TargetType="ScrollViewer">
<Setter Property="BorderThickness" Value="0,1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollViewer">
<Grid>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="0,-1" Opacity="0.2" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}">
<Border.OpacityMask>
<LinearGradientBrush EndPoint="1.07,0.5" StartPoint="-0.07,0.5">
<GradientStop Color="#FF000000"/>
<GradientStop Color="#7FFFFFFF" Offset="0.5"/>
<GradientStop Color="#FF000000" Offset="1"/>
</LinearGradientBrush>
</Border.OpacityMask>
</Border>
<Grid Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ScrollContentPresenter x:Name="ScrollContentPresenter" Cursor="{TemplateBinding Cursor}" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="{TemplateBinding Padding}"/>
<Rectangle Grid.Column="1" Fill="#FFE9EEF4" Grid.Row="1"/>
<ScrollBar x:Name="VerticalScrollBar" Grid.Column="1" IsTabStop="False" Maximum="{TemplateBinding ScrollableHeight}" Margin="0,-1" Minimum="0" Orientation="Vertical" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{TemplateBinding VerticalOffset}" ViewportSize="{TemplateBinding ViewportHeight}" Width="18"/>
<ScrollBar x:Name="HorizontalScrollBar" Grid.Column="0" Height="18" IsTabStop="False" Maximum="{TemplateBinding ScrollableWidth}" Margin="-1,0,-1,-1" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{TemplateBinding HorizontalOffset}" ViewportSize="{TemplateBinding ViewportWidth}"/>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Border.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ScrollViewer Background="{x:Null}" IsTabStop="False" Padding="{TemplateBinding Padding}" Style="{StaticResource CustomScrollViewerStyle}" VerticalScrollBarVisibility="Auto">
<ContentPresenter x:Name="ContentPresenter" Margin="12,12,6,12"/>
</ScrollViewer>
<Grid Margin="0,8,0,8" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="CommitButton" Content="{TemplateBinding CommitButtonContent}" Grid.Column="1" HorizontalAlignment="Right" HorizontalContentAlignment="Center" Margin="0,0,12,0" MinWidth="75" MinHeight="22" Style="{TemplateBinding CommitButtonStyle}" Visibility="Collapsed" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
</Grid>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
... View more
02-08-2011
07:54 AM
|
0
|
0
|
634
|
|
POST
|
I'm having a problem with a feature layer. When the print preview window appears, my feature layer graphics appear on the preview map, but disappear from the main map. I tested the print sample with feature layers again and I didn't notice the issues you are talking about. Note that in the sample, when cloning a map, the graphic layers are a specific case since we need to clone the graphics as well. It's why there is code like this one: // For graphics layer, a clone of the graphic collection is done and is frozen
// No web requests will be done
private static Layer CloneLayer(Layer layer)
{
Layer toLayer;
if (layer is GraphicsLayer) // Include FeatureLayer and GeoRSS layers
{
var fromLayer = layer as GraphicsLayer;
var printLayer = new GraphicsLayer();
............ Check that you are using the same kind of code and that your graphics are cloned. Once the graphics are cloned, the preview window should not impact the main window. Another issue I am running into involves clustering. If I bring up the print preview window and zoom in, some of clusters will split apart into individual graphics as I would expect. When I close the preview window (and pan to get the graphics to show up in the main window again), the clustering that appears is how it appeared in the preview map, even though the main map extent may be different (in other words the individual graphics will show up based on the preview extent). Likely this's tied to the previous issue, if the graphics are not cloned, you can end up with this kind of situation.
... View more
02-07-2011
10:54 PM
|
0
|
0
|
1785
|
|
POST
|
The example is only projection one point and obviously the drawn area (polygon) or line could/will have several (undefined) number of points. The project geometry service is able to project any geometry type (and even any list of geometries), so you don't need to project point by point. The global process should be this one: 1) Project your geometry (call ProjectAsync) 2) On ProjectCompleted : calculate the area/lenght (call AreasAndLenghtsAsync) 3) On AreasAndLenghtsAsyncCompleted : your measure is available Hope this help.
... View more
02-04-2011
12:40 AM
|
0
|
0
|
1984
|
|
POST
|
I have added the ability to dynamically add an ArcGISDynamicLayer Map Service to the map and to the TOC/Legend. But, it places it at the bottom of the legend, and I would like to place it at the top. By default, the entries in the legend are in the same order than the layers in the map. So, if you add a layer at the bottom of the map, it will be at the bottom of the legend. If you want to change this behavior, the easier way is to set the LayerIds property. The legend will be ordered as the LayerIds. For some scenarios, it might also be useful to reorder dynamically by code on the event Legend.Refreshed. A code like this one should do the job: private void Legend_Refreshed(object sender, Legend.RefreshedEventArgs e)
{
Legend legend = sender as Legend;
if (e.LayerItem.Layer.ID == "MyTopLayerID")
{
legend.LayerItems.Remove(e.LayerItem); // Remove legend entry from its current location
legend.LayerItems.Insert(0, e.LayerItem); //Add it at the top
}
}
... View more
02-04-2011
12:28 AM
|
0
|
4
|
2148
|
|
POST
|
polygon.SpatialReference = new SpatialReference(54004);
Setting the spatial reference by code is not enough because by doing this, the coordinates of the geometry don't change. You have to project the coordinates by using a geometry service. As a side note, I think that the equal area projection is 54034 and not 54004.
... View more
02-03-2011
01:07 AM
|
0
|
0
|
1984
|
|
POST
|
hummm, verify that there is no default legend style defined somewhere in your application (most likely in app.xaml). If it's the case, remove this default legend style.
... View more
02-02-2011
12:40 PM
|
0
|
0
|
2874
|
|
POST
|
From the screenshot, it might be that your server has not been updated to 10SP1 and so, the legend service is not available (furthermore, in your case, the arcgis.com fallback mechanism is not available because your service is not public). Please check by querying http://localhost/ArcGIS/rest/services, if you are in 10SP1, you should see Version=10.01 .
... View more
02-02-2011
12:13 PM
|
0
|
0
|
2874
|
|
POST
|
At first glance, your code looks good except if your field is a coded domain. In this case you have to use the code value for 'Available'.
... View more
02-02-2011
11:23 AM
|
0
|
0
|
2004
|
|
POST
|
The sample you mentionned is using LayerItemsMode = "Tree" and is working well. So there is something specific to your tempalte or your data. Could you share your legend template and a screenshot of the result?
... View more
02-02-2011
11:08 AM
|
0
|
0
|
2874
|
|
POST
|
There is an example of GraphicsLayer serialization here : http://forums.arcgis.com/threads/8774-save-layer-to-xml-file but there are some limitations : for example the symbols are not serialized.
... View more
02-02-2011
11:05 AM
|
0
|
0
|
1585
|
|
POST
|
When did you download the code? The sample has been updated January, the 21st here : http://www.arcgis.com/home/item.html?id=b135d66549364786b381e85451742d56 It's now working with SL4, the latest toolkit and ArcGIS SL 2.1. You can also get the code in this thread : http://forums.arcgis.com/threads/21286-Charting-issues-in-10
... View more
02-02-2011
03:45 AM
|
0
|
0
|
700
|
|
POST
|
You are welcome:) However, thematic mapping is still not working with class breaks. Has the ClassBreakInfo or any thing else changed? Could you give more info about the class break issue? (as the sample is not using ClassBreakInfo, I guess it's not an issue with the sample).
... View more
02-02-2011
03:41 AM
|
0
|
0
|
1048
|
|
POST
|
when the user choses a map service, we want to display a preview of the map, and also if more than one map service is selected for a given site, to be able to overlay these on each other in the same preview. Any idea how this can be done? I probably missed the point. What are the issues with a 'classic' Map having layers corresponding to the services that you want to overlay?
... View more
02-02-2011
03:36 AM
|
0
|
0
|
685
|
| 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
|