We are updating from Windows Mobile 10 to Runtime SDK for Mobile 3.1. In our Mobile 10 application, the user can search for a feature by selecting attributes from a combo box. The results display in a listview. The user can select an item and click on a menu item to zoom to the selected feature on the map.
In Mobile 10, the code behind the menu zoom click event sets the feature as selected on the map, then zooms the map to an envelope created using the feature geometry. The code to select the feature is:
SelectionGraphicLayer lyr = _map.MapGraphicLayers.GetFirstLayerOfType(typeof(SelectionGraphicLayer)) as SelectionGraphicLayer;
lyr.SelectedGeometries.Add(featureDataRow.Geometry);
I'm having trouble setting a feature as selected using the RuntimeSDK v3.1. In v3.1, the SelectionGraphicLayer is a MapGraphicLayer which takes Graphics (not geometries). Graphics is a read-only list. So I can't add to the SelectionGraphicLayer like I did in Mobile 10.
public IList<MapGraphic> Graphics {get;}
If you are selecting features in code, please provide an example of how to do it.