Пример #1
0
        private void Init()
        {
            SelectedSnippet = AllSnippets.FirstOrDefault();

            AllSnippetsView        = CollectionViewSource.GetDefaultView(AllSnippets);
            AllSnippetsView.Filter = AllSnippetsView_Filter;
            AllSnippetsView.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
            AllSnippetsView.GroupDescriptions.Add(new PropertyGroupDescription("Language"));
        }
Пример #2
0
 private void DeleteSnippet() //nur verfügbar, wenn SelectedSnippet != null ist
 {
     if (MessageBox.Show("Wollen sie den Snippet Eintrag wirklich löschen?", "Warnung", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
     {
         AllSnippets.Remove(AllSnippets.FirstOrDefault(x => x.ID == SelectedSnippet.ID));
         DataContext.Instance.Snippets = new List <Snippet>();
         AllSnippets.ToList().ForEach(x => DataContext.Instance.Snippets.Add(x.Snippet_Model));
         SelectedSnippet = AllSnippets.FirstOrDefault();
     }
 }