Binding feature layer in code-behind

575
0
06-13-2013 11:13 AM
chengbiliu
New Contributor
Hi!
I have a question about binding in c# code-behind. Here's my code in c#
private void exportSelected_Click(object sender, RoutedEventArgs e)
  {
   FeatureLayer fe = (FeatureLayer)Map.Layers["Area"];
   ete.ExportData(fe.SelectedGraphics.ToList(), MyDataGrid.Columns);
  }


"Area" is one of the layers in a group layer called "NHD" in xaml. I'm currently using a combobox to select them.
<ComboBox x:Name="Attributes"
          ItemsSource="{Binding ElementName=Map, Path=Layers.[NHD]}"
          VerticalAlignment='Bottom'
          Height='30'
          Grid.Row='1'
          SelectedIndex='0'>
      <ComboBox.ItemTemplate>
       <DataTemplate>
        <TextBlock Text="{Binding LayerInfo.Name}" />
       </DataTemplate>
      </ComboBox.ItemTemplate>
     </ComboBox>

Is it possible to bind the code in c# to my selected item in xaml? Thanks for your generous help in advance.
0 Kudos
0 Replies