private void Button_Click(object sender, RoutedEventArgs e) { if (txbFindProduct.Text == "") { products = new ObservableCollection <Detail_Product>(dbProduct.LoadData_Product()); listviewShowProduct.ItemsSource = products; } else { ObservableCollection <Detail_Product> searchproducts = new ObservableCollection <Detail_Product>(); searchproducts = dbProduct.SearchProduct(txbFindProduct.Text); if (searchproducts.Count > 0) { listviewShowProduct.ItemsSource = searchproducts; } else { var dialog = new Dialog() { Message = "Do not find any product!" }; dialog.Owner = Window.GetWindow(this); dialog.ShowDialog(); } txbFindProduct.Text = ""; } }