Is it possible to get a more robust mechanism to extract the currently selected item from the Legend control? I've been fighting with the Tree class as well as the "LayerItemViewModel" or "LegendItemViewModel" to extract out which layer from the collection of layers loaded into the Map Viewer control is currently selected. I would like to determine the Layer Type (Dynamic Layer, Feature Layer, etc.) as well as the Layer ID. This would enable me to set the various other controls like Identify control, Editor control, etc.
My biggest challenge is that I can't figure out a practical way to determine the "Parent Layer" of a Feature layer if that feature layer has styles assigned to it? The LegendTree could potentially provide me a way to grab the Parent Layer ID using something like this "itm.LegendTree.LayerItems.Items(itm.LegendTree.LayerItemsMode)" but it's not an exposed item?
Any thoughts?