예제 #1
0
        public void NewCategory(object o, EventArgs e)
        {
            SnippetCategory s = new SnippetCategory();

            s.Name = "New Category";
            SnippetCategories.Add(s);
        }
예제 #2
0
        public void DoGridDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.Text))
            {
                // create a new category
                SnippetCategory sc = new SnippetCategory();
                sc.Name = "New Category";
                SnippetCategories.Add(sc);

                string Text = (string)e.Data.GetData(DataFormats.Text);
                sc.AddSnippet("New Snippet", "", Text);

                TabItem ti = (TabItem)SnippetCategoriesTabControl.ItemContainerGenerator.ContainerFromItem(sc);
                if (ti != null)
                {
                    ti.IsSelected = true;
                }

                // write the xaml file
                WriteValues();

                // don't allow drops here anymore
                MainGrid.AllowDrop = false;
                MainGrid.Drop     -= new DragEventHandler(DoGridDrop);
            }
        }