Click here to Skip to main content
15,891,673 members
Home / Discussions / C#
   

C#

 
JokeRe: lock .net code Pin
Bassam Saoud19-Aug-08 9:18
Bassam Saoud19-Aug-08 9:18 
AnswerRe: lock .net code Pin
chaiguy133719-Aug-08 15:42
chaiguy133719-Aug-08 15:42 
QuestionContextMenu Help Pin
Harvey Saayman19-Aug-08 3:21
Harvey Saayman19-Aug-08 3:21 
AnswerRe: ContextMenu Help Pin
Abhijit Jana19-Aug-08 7:03
professionalAbhijit Jana19-Aug-08 7:03 
GeneralRe: ContextMenu Help Pin
Harvey Saayman19-Aug-08 9:02
Harvey Saayman19-Aug-08 9:02 
AnswerRe: ContextMenu Help Pin
DaveyM6919-Aug-08 12:41
professionalDaveyM6919-Aug-08 12:41 
GeneralRe: ContextMenu Help Pin
Harvey Saayman19-Aug-08 20:36
Harvey Saayman19-Aug-08 20:36 
GeneralRe: ContextMenu Help Pin
DaveyM6920-Aug-08 2:46
professionalDaveyM6920-Aug-08 2:46 
By adding a MenuItem instance rather than just a string you can do it this way
using System;
using System.Windows;
using System.Windows.Controls;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
            System.Windows.Controls.ContextMenu cm = new ContextMenu();
            MenuItem item = new MenuItem();
            item.Header = "test";
            item.Click += new RoutedEventHandler(item_Click);
            cm.Items.Add(item);
            this.ContextMenu = cm;
        }

        void item_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item = (MenuItem)sender;
            Console.WriteLine(item.Header);
        }
    }
}


Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog)

GeneralRe: ContextMenu Help Pin
Harvey Saayman20-Aug-08 2:57
Harvey Saayman20-Aug-08 2:57 
QuestionProblem with databinding to property of interface type. Pin
Member 140473319-Aug-08 3:08
Member 140473319-Aug-08 3:08 
AnswerRe: Problem with databinding to property of interface type. Pin
MidwestLimey19-Aug-08 4:37
professionalMidwestLimey19-Aug-08 4:37 
GeneralRe: Problem with databinding to property of interface type. Pin
Member 140473319-Aug-08 19:43
Member 140473319-Aug-08 19:43 
AnswerRe: Problem with databinding to property of interface type. Pin
Member 140473320-Aug-08 21:14
Member 140473320-Aug-08 21:14 
QuestionMicrosoft.SqlServer.Management.Smo problem Pin
hdv21219-Aug-08 2:58
hdv21219-Aug-08 2:58 
AnswerRe: Microsoft.SqlServer.Management.Smo problem Pin
Csharp_Raja19-Aug-08 3:42
Csharp_Raja19-Aug-08 3:42 
GeneralRe: Microsoft.SqlServer.Management.Smo problem Pin
hdv21219-Aug-08 4:08
hdv21219-Aug-08 4:08 
GeneralRe: Microsoft.SqlServer.Management.Smo problem Pin
Csharp_Raja19-Aug-08 4:50
Csharp_Raja19-Aug-08 4:50 
GeneralRe: Microsoft.SqlServer.Management.Smo problem Pin
hdv21219-Aug-08 4:55
hdv21219-Aug-08 4:55 
GeneralRe: Microsoft.SqlServer.Management.Smo problem Pin
Csharp_Raja20-Aug-08 4:34
Csharp_Raja20-Aug-08 4:34 
Questionout of memory:at System.image.fromfile(string filename,boolean useembeddedcolormanagement) Pin
vishnukamath19-Aug-08 2:44
vishnukamath19-Aug-08 2:44 
AnswerRe: out of memory:at System.image.fromfile(string filename,boolean useembeddedcolormanagement) Pin
Manas Bhardwaj19-Aug-08 5:16
professionalManas Bhardwaj19-Aug-08 5:16 
QuestionAccess to the file in the same directory Pin
arkiboys19-Aug-08 2:17
arkiboys19-Aug-08 2:17 
AnswerPlease don't repost questions just to bump them to the top. Pin
Pete O'Hanlon19-Aug-08 2:21
mvePete O'Hanlon19-Aug-08 2:21 
GeneralRe: Please don't repost questions just to bump them to the top. Pin
arkiboys19-Aug-08 2:26
arkiboys19-Aug-08 2:26 
RantRe: Please don't repost questions just to bump them to the top. Pin
Paul Conrad19-Aug-08 6:18
professionalPaul Conrad19-Aug-08 6:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.