ググってもやや引っかかりが悪かったのでメモ。
System.Windows.Controls.Image image = new System.Windows.Controls.Image(); image.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\bike.jpg")); image.ContextMenu = new System.Windows.Controls.ContextMenu(); System.Windows.Controls.MenuItem item = new System.Windows.Controls.MenuItem(); item.Header = "Click me!"; item.Click += new System.Windows.RoutedEventHandler(delegate(object obj, System.Windows.RoutedEventArgs args) { System.Windows.MessageBox.Show("hoge"); }); image.ContextMenu.Items.Add(item);
0 件のコメント:
コメントを投稿