The key here is to assign the DataGrid's ItemsSource once through Binding to an instance of your ObservableCollection and manipulate this collection instead of re-assigning the DataGrid's ItemsSource because that will defeat the purpose of Binding.In your XAML, you can create an instance of your PipeGrid or simply use esri's GraphicCollection.
<Grid x:Name="LayoutRoot" Background="White">
<Grid.Resources>
<esri:GraphicCollection x:Key="MyGraphicCollection"/>
</Grid.Resources>
<!-- more code goes here -->
<slData:DataGrid x:Name="QueryDetailsDataGrid" ItemsSource="{Binding Source={StaticResource MyGraphicCollection}}"
<!-- more code goes here -->
In the code-behind, you can grab the instance of your ObservableCollection and update them after the query has completed.
public MainPage()
{
InitializeComponent();
myGraphics = this.LayoutRoot.Resources["MyGraphicCollection"] as GraphicCollection;
}
GraphicCollection myGraphics;
void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
{
FeatureSet featureSet = args.FeatureSet;
if (featureSet != null && featureSet.Features.Count > 0)
{
if (myGraphics != null)
{
myGraphics.Clear();
foreach (Graphic g in featureSet.Features)
myGraphics.Add(g);
}
}
}
This way anytime you remove a graphic from myGraphics, the DataGrid updates itself.