Esri / arcgis-maps-sdk-dotnet-toolkit

Toolkit for ArcGIS Maps SDK for .NET
https://esri.github.io/arcgis-maps-sdk-dotnet-toolkit/
Apache License 2.0
217 stars 121 forks source link

How to make dotnet legend look and behave exactly like the Silverlight legend #117

Closed befoley1960 closed 6 years ago

befoley1960 commented 8 years ago

I am re-writing an existing ArcGIS Silverlight application to a .net solution. I am trying to create a legend using the toolkit, but am having some difficulty. I want my legend to look and behave exactly like the Silverlight legend. The Silverlight legend was so simple, all layers and sub-layers displayed easily. I had checkboxes to turn on/off individual sub-layers with no extra coding needed. The new .net solution requires a good bit of coding on my part to give the same functionality. This is slowing me down considerably.

dotMorten commented 8 years ago

The Silverlight legend wasn't really a legend, but was actually a table of contents control with a legend for each layer inside each item.

In the .NET SDK this has been more clearly distinguished to allow more control. The legend is just a legend. It renders the legend for a layer. You can use an ItemsControl bound to the Layers collection. In the item template put your checkbox bound to IsVisible, and a Legend bound to the layer.

Also see the LegendsInTreeView sample: https://github.com/Esri/arcgis-toolkit-dotnet/tree/master/samples/WinDesktop/ArcGISRuntime.Toolkit.Samples/Legend

befoley1960 commented 8 years ago

Morten, thanks for your reply. I was able to tweak the LegendItemViewModel.cs to get the legend to work the way I wanted it to in the WPF Desktop Application. Now, when I copied the code over to my WPF Browser Application, I can’t get the legend class to instantiate. You would think that the code would work on both platforms.

befoley1960 commented 8 years ago

Morten, do you have a private email that I could use to correspond with you ?

befoley1960 commented 8 years ago

Another question I have is at what point does the Legend class get invoked ? I am setting it up in the UserControl.Resources section of my control, within a HierarchicalDataTemplate.

dotMorten commented 6 years ago

We're working on entirely new design for legend and ToC controls for v100.x