Select to view content in your preferred language

Legend item template brings a huge image....Why?????

3487
8
05-07-2014 02:24 PM
Cristian_Galindo
Frequent Contributor
DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far???


Using the legend control I defined the following template
                  <esri:Legend.LegendItemTemplate >
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Loaded="StackPanel_OnLoaded"  >
                                 <Image Source="{Binding ImageSource}" Tag="{Binding Tag}" ></Image>                                
                                <TextBlock Text="{Binding Label}" Background="Aqua"></TextBlock>
                            </StackPanel>
                        </DataTemplate>
                    </esri:Legend.LegendItemTemplate>


The legend is shown in the following way

[ATTACH=CONFIG]33658[/ATTACH]

after checking the LegendItemViewModel, i discover that the ImageSource Width property is set to 320 and Height property is set to 290.

What could affect that size?, in an external test application, the size is about ten times smaller.
it is tied up to any style?
0 Kudos
8 Replies
DominiqueBroux
Esri Frequent Contributor
I am not sure which kind of layer you are referring to, but it's a WMS layer it often happens that the legend image provided by the service is that size. With WMS, all symbols for the layer are grouped into one image.
Likely the legend provided by the service is actually 320*290 so there is no bug here.

You can try setting a maxheight and maxwidth in the LegendItemTemplate but the legend will be stretched and may become unreadable.
0 Kudos
Cristian_Galindo
Frequent Contributor
I am not sure which kind of layer you are referring to,


thanks for your answer, I know that I do not write that information in the post. Currently I'm using a Graphics layer, where the objects are created an the symbol is set.

I tried to crop the image, to set the max values, but the result is the same, the image is too big.  i'm not familiar with ImageSource class.

I must peek in the github code about the legend control, trying to understant when, and how this image is created.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Currently I'm using a Graphics layer, where the objects are created an the symbol is set.

A graphics layer without renderer and without clustering should not have any legend item.
How do you setup your graphics layer?
0 Kudos
Cristian_Galindo
Frequent Contributor
Hi Dominique

I set up the renderer, and it appear in the map
0 Kudos
DominiqueBroux
Esri Frequent Contributor
I set up the renderer, and it appear in the map

If you setup a renderer, the renderer symbols should be displayed with the same size in the map and in the legend.
What is the expected size of your symbols in the map?
0 Kudos
Cristian_Galindo
Frequent Contributor
the graphics are lines, and in the map, they appear as expected.

in an isolated simple application, the symbology appears in the legend control in a width of 32*29 pixels ImageSource object. but in my production application the size is ten times
0 Kudos
DominiqueBroux
Esri Frequent Contributor
The swatch of a line symbol is supposed to have a hardcoded size of 20*20.
I have no clue where this 320*290 size could come from.

I would need a repro case. Could you provide one?
0 Kudos
Cristian_Galindo
Frequent Contributor
Hi Dominique...


I'm trying to reproduce the behavior in a isolate environment. so far i dont get it.
0 Kudos