void Boundaries_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0)
     {
         SingleBndGrid.Children.Clear();
         if (((Microsoft.Windows.Controls.DataGrid)sender).Name.Equals("GWBoundaries"))
         {
             var gw = new GroundwaterBoundaryView();
             gw.DataContext = e.AddedItems[0];
             SingleBndGrid.Children.Add(gw);
             SourcesBoundary.SelectedIndex = -1;
             SinksBoundary.SelectedIndex   = -1;
         }
         else if (((Microsoft.Windows.Controls.DataGrid)sender).Name.Equals("SinksBoundary"))
         {
             SourcesBoundary.SelectedIndex = -1;
             GWBoundaries.SelectedIndex    = -1;
         }
         else
         {
             var sb = new SourceBoundaryView();
             sb.DataContext = e.AddedItems[0];
             SingleBndGrid.Children.Add(sb);
             GWBoundaries.SelectedIndex  = -1;
             SinksBoundary.SelectedIndex = -1;
         }
     }
 }
 void Boundaries_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
   if (e.AddedItems.Count > 0)
   {
     SingleBndGrid.Children.Clear();
     if (((Microsoft.Windows.Controls.DataGrid)sender).Name.Equals("GWBoundaries"))
     {
       var gw = new GroundwaterBoundaryView();
       gw.DataContext = e.AddedItems[0];
       SingleBndGrid.Children.Add(gw);
       SourcesBoundary.SelectedIndex = -1;
       SinksBoundary.SelectedIndex = -1;
     }
     else if (((Microsoft.Windows.Controls.DataGrid)sender).Name.Equals("SinksBoundary"))
     {
       SourcesBoundary.SelectedIndex = -1;
       GWBoundaries.SelectedIndex = -1;
     }
     else
     {
       var sb = new SourceBoundaryView();
       sb.DataContext = e.AddedItems[0];
       SingleBndGrid.Children.Add(sb);
       GWBoundaries.SelectedIndex = -1;
       SinksBoundary.SelectedIndex = -1;
     }
   }
 }