private void Window_Loaded(object sender, RoutedEventArgs e) { try { List <Property> viewProperty = propertyBL.GetDeActivatedPropertyBL(); if (viewProperty != null && viewProperty.Count > 0) { dgViewProperties.DataContext = viewProperty; } else { MessageBox.Show("No record found"); } } catch (EasyHousingSolutionException ex) { MessageBox.Show("Error: " + ex); } catch (Exception ex) { MessageBox.Show("Error: " + ex); } }