I am trying to dynamically create a legend in another window or panel. I am looking to see if it is possible to have ThinkGeo render the images for the legend, but for me to be able to display it in something like a ScrollViewer.
What I am looking to do is create a floating window, put in a ScrollViewer, and dynamically add the layer names and legend items. I also am using multiple classifications for the majority of my layers.
The reason I want to use a separate window/panel instead of the AdornmentLayer is that I have combined 30+ layers plus many of those layers have anywhere from 3-8 different symbols. So, it does not entirely become feasible to contain that in a static overlay like the AdornmentLayer.
When I originally was constructing this, I had tried to figure out a way to use the LegendItem.Draw() function to draw the image to a GeoCanvas and then add it to some type of UI Element. I was not able to figure that out though.
Basically, I am looking to see if this is possible with ThinkGeo’s software doing the heavy lifting instead of me coding it through other means. I want something that is draggable and re-sizable. So, for my purposes, I thought a separate window with stack panels would be easiest.
Legend Layer Questions
Hi Brandon,
Do you think this idea will works for you?
Put a new map which only contains legend layer in a new window.
Then popup this window in your main window.
Then update the new window in some event like extentChange.
I think follow this way you don’t need write more code.
Regards,
Don
Basically, I am looking for a way to add more customization to the legend. As far as I saw, I am not able to adjust columns, rows, layout, etc using the LegendItem and LegendAdornmentOverlay. I am just hopeful I would have access to the images your software is drawing for the legend.
I thought about a separate window and overlay, but that would limit me to your default layout still.
Hi Brandon,
For LegendAdornmentLayer the only function which can be overridden is DrawCore and which you can get is the GeoCanvas.
So if you want to get the image, I think you can try to use canvas.NativeImage to get it.
If you want to get image from single item, you should want to research override DrawCore of LegendItem.
I am not sure whether they can works follow your requirement but it looks we cannot get other information from the two classes.
Regards,
Don