Пример #1
0
        private void BooksListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ListView listView = sender as ListView;
            Book     selected = listView.SelectedItem as Book;

            BookWindow window = new BookWindow(selected);

            window.Title = "Edit Book";
            window.ShowDialog();

            //refilter
            collectionViewSource.View.Filter = Filter;
        }
Пример #2
0
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            BookWindow window = new BookWindow();

            window.Title = "Insert New Book";
            window.ShowDialog();

            if (window.OKFlag)
            {
                Book newBook = window.Book;
                books.Add(new Book(newBook.Author, newBook.Title, newBook.Year));

                //refilter
                collectionViewSource.View.Filter = Filter;
            }
        }