Thanks Jennifer!You did it! It was the "FeatureLayer.Update()" line that did it.In my query, I leave out types = 14 in order to show on screen only types = 11. The type 14 is on screen already; then, I issue a run-time query from code-behind and retrieve types = 11. The whole idea is to remove the 14s from the screen and place the 11s instead. It works!I did have to add the "FeatureLayer_UpdateFailed" event in order for the "FeatureLayer_UpdateCompleted" event to execute; the latter was not executing without the former. I use the "FeatureLayer_UpdateCompleted" event for further processing of those newly retrieved features.The whole process is like this:1. Retrieve types 14 at page first load (XAML):<esri:FeatureLayer ID="MyMeters" Renderer="{StaticResource AlertTypesRenderer}" OutFields="*" Where="AlertType = 14" Url="my-url" MouseLeftButtonDown="FeatureLayer_MouseLeftButtonDown" />
2. Bind the feature data grid to the feature layer (XAML):<esri:FeatureDataGrid x:Name="MyDataGrid" Map="{Binding ElementName=MyMap}"
GraphicsLayer="{Binding ElementName=MyMap, Path=Layers.[MyMeters]}" SelectionChanged="MyDataGrid_SelectionChanged" />
3. At run-time, perform another query to retrieve types = 11 and remove from screen the 14s that were retrieved at page load with XAML code (cf. step 1):public void ReLoadMeters()
{
// Create an instance referencing the already existing feature layer
FeatureLayer fs = MyMap.Layers["MyMeters"] as FeatureLayer;
// Set event handler on feature layer feature retrieval.
fs.UpdateCompleted += FeatureLayer_UpdateCompleted;
fs.UpdateFailed += new EventHandler<Tasks.TaskFailedEventArgs>(FeatureLayer_UpdateFailed);
fs.Where = "AlertTypes = 11";
fs.Update();
}
4. Define the "FeatureLayer_UpdateCompleted" event for further processing of newly retrieved features:private void FeatureLayer_UpdateCompleted(object sender, EventArgs args)
{
FeatureLayer fs = sender as FeatureLayer;
foreach (Graphic graphic in fs.Graphics)
{
// Here I do my further processing with the newly retrieved features
}
}
5. Define the "FeatureLayer_UpdateFailed" event handler (the event at step 4 was not firing without this one):private void FeatureLayer_UpdateFailed(object sender, EventArgs args)
{
FeatureLayer fs = sender as FeatureLayer;
// Catch any errors here...
}
Now, my feature data grid and the features on screen are in syn all the time: the attributes for those features on screen are listed on the feature data grid; when I click on a map feature or on a row, the map zooms in to the feature and the row highlights.Thanks again, Jennifer!Hugo.