private void InsertSnippetClick(object sender, RoutedEventArgs e) { if (lstSnippets.SelectedItem != null) { SnippetsDataSet.SnippetsTableRow r = ((DataRowView)lstSnippets.SelectedItem).Row as SnippetsDataSet.SnippetsTableRow; TheModel.HandleInsertSnippetClick(r); } }
private void CreateContextMenu() { var m = TheContextMenu = new ContextMenu(); var i = new MenuItem("Insert Snippet"); i.Click += (s, e) => { if (PopupSource != null) { TheModel.HandleInsertSnippetClick(PopupSource.TheSnippet.Row); } }; m.MenuItems.Add(i); i = new MenuItem("Insert full Code Sample"); i.Click += (s, e) => { if (PopupSource != null) { TheModel.HandleInsertFullCodeClick(PopupSource.TheSnippet.Row); } }; m.MenuItems.Add(i); i = new MenuItem("Insert Dependencies"); i.Click += (s, e) => { if (PopupSource != null) { TheModel.HandleInsertDependenciesClick(PopupSource.TheSnippet.Row); } }; m.MenuItems.Add(i); m.MenuItems.Add(new MenuItem("-")); var mm = new MenuItem("Thumbnails"); var ioff = new MenuItem("Off") { RadioCheck = true }; ioff.Click += (s, e) => { ThumbnailSize = 0; }; mm.MenuItems.Add(ioff); var ismall = new MenuItem("Small") { RadioCheck = true }; ismall.Click += (s, e) => { ThumbnailSize = 40; }; mm.MenuItems.Add(ismall); var imiddle = new MenuItem("Medium") { RadioCheck = true }; imiddle.Click += (s, e) => { ThumbnailSize = 70; }; mm.MenuItems.Add(imiddle); var ilarge = new MenuItem("Large") { RadioCheck = true }; ilarge.Click += (s, e) => { ThumbnailSize = 150; }; mm.MenuItems.Add(ilarge); m.MenuItems.Add(mm); m.Popup += (s, e) => { PopupSource = TheContextMenu.SourceControl as SnippetEntry; ioff.Checked = ThumbnailSize == 0; ismall.Checked = ThumbnailSize == 40; imiddle.Checked = ThumbnailSize == 70; ilarge.Checked = ThumbnailSize == 150; }; }