I'm trying to use some spatial selection buttons with several feature layers and several graphic layers. I have a basic drop down list box to select the layer that is active and in my code behind I want handle the selection. I have the graphic layers handled but I'm having trouble with the feature layer. In my XAML I've set the my FeatureLayer modes to Selection and instead of setting everything in XAML I want to set it in code behind. I know it is better practice to set it in XAML but I feel I need to do everything in the code behind. My question is How do I set the properties for the feature layer in C# (behind): Binding to MyMap and My LayerID (ex. Map="{Binding ElementName=MyMap}" LayerIDs="CensusDemographics"), Set SelectionMode, Set Continuous Mode, Set the Command to Select and the CommandParameter to equal new.Below is the dismal code I have; I tired to look everything up in the API Ref but I just have such a hard time reading and following the API Ref. I always thought that would be a great Dev. Summit Session or a U.C. Session. Probably too basic but us true non-programmers might enjoy it. Thanks in Advance.
private void SelectButton_Click(object sender, RoutedEventArgs e)
{
if (Layers.SelectedIndex == 0) //Graphic Layer
{
MyDrawSurface.DrawMode = DrawMode.Rectangle;
MyDrawSurface.IsEnabled = (MyDrawSurface.DrawMode != DrawMode.None);
}
if (Layers.SelectedIndex == 1) //Feature Layer
{
//Here's where I'm havin the trouble:
SelectButton.CommandParameter = SelectionMode.Multiple;
// SelectButton.SetBinding;
QueryDetailsDataGrid.GraphicsLayer = Map.Layers["LINES"] as FeatureLayer;
ResultsDisplay.IsExpanded = true;
}
}