Binding to Selected Feature

Discussion created by keithgemeinhart on Jun 21, 2013
Latest reply on Jul 1, 2013 by akajanus-esristaff
Given a ArcGISLocalFeatureLayer as a layer on the WPF runtime map object, how can I bind a ViewModel to the selected feature or graphic?

<esri:ArcGISLocalFeatureLayer x:Name="MySampleLayer" ID="MyFeatures" 
Path="C:/..../Samples.mpk" LayerName="MyFeatures" OutFields="*" DisableClientCaching="True" 
Editable="True" AutoSave="False"  ValidateEdits="True" 
Mode="OnDemand"  SelectionColor="#FFFFFF00" />

I realize there is already a FeatureDataGrid and FeatureDataForm in the runtime, but I'm trying to achieve a little different user experience. For simplicity, suppose I just have some controls on the same window as the map:
        <Grid >
                <TextBox Text="{Binding FeatureName}" />
                <TextBox Text="{Binding FeatureInfo}" />

and a simple ViewModel ...

    class FeaturePropertiesViewModel  
        public string FeatureName { get; set; }
        public string FeatureInfo { get; set; }

        public Graphic SelectedFeature { get; set; }     // ??? use this somehow?
        public GraphicCollection AllGraphics { get; set; }  // ??? use this somehow? 

How do I get those text fields updated to when a new feature is selected? Ideally, I'd like two-way binding so that changing the text updates the underlying feature class.