Click here to Skip to main content
15,920,801 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to cast an object using its handle? Pin
MAP Tiger12-Dec-08 8:43
MAP Tiger12-Dec-08 8:43 
AnswerRe: How to cast an object using its handle? Pin
Dave Kreskowiak12-Dec-08 7:14
mveDave Kreskowiak12-Dec-08 7:14 
GeneralRe: How to cast an object using its handle? Pin
MAP Tiger12-Dec-08 7:27
MAP Tiger12-Dec-08 7:27 
GeneralRe: How to cast an object using its handle? Pin
Dave Kreskowiak12-Dec-08 8:24
mveDave Kreskowiak12-Dec-08 8:24 
QuestionMulticolor Text in Textbox OR Listbox Pin
Michael Fritzius12-Dec-08 5:23
professionalMichael Fritzius12-Dec-08 5:23 
AnswerRe: Multicolor Text in Textbox OR Listbox Pin
ARon_12-Dec-08 5:47
ARon_12-Dec-08 5:47 
GeneralRe: Multicolor Text in Textbox OR Listbox Pin
Michael Fritzius12-Dec-08 7:36
professionalMichael Fritzius12-Dec-08 7:36 
QuestionHow to communication between buisness layer and UI layer in a three-tier project Pin
jinmengcheng12-Dec-08 4:48
jinmengcheng12-Dec-08 4:48 
AnswerRe: How to communication between buisness layer and UI layer in a three-tier project Pin
Ben Fair12-Dec-08 9:48
Ben Fair12-Dec-08 9:48 
GeneralRe: How to communication between buisness layer and UI layer in a three-tier project Pin
Uwe Keim12-Dec-08 9:51
sitebuilderUwe Keim12-Dec-08 9:51 
QuestionNewbie :- How to pass which UIElement name on? Pin
me0812-Dec-08 3:56
me0812-Dec-08 3:56 
AnswerRe: Newbie :- How to pass which UIElement name on? Pin
dan!sh 12-Dec-08 4:32
professional dan!sh 12-Dec-08 4:32 
AnswerRe: Newbie :- How to pass which UIElement name on? Pin
DaveyM6912-Dec-08 4:40
professionalDaveyM6912-Dec-08 4:40 
AnswerRe: Newbie :- How to pass which UIElement name on? [modified] Pin
ARon_12-Dec-08 5:40
ARon_12-Dec-08 5:40 
GeneralRe: Newbie :- How to pass which UIElement name on? Pin
me0812-Dec-08 9:03
me0812-Dec-08 9:03 
GeneralRe: Newbie :- How to pass which UIElement name on? Pin
ARon_12-Dec-08 10:03
ARon_12-Dec-08 10:03 
I hoped I helpled.

Comments.

This is out side the foeach loop so you only adding once.
ImageMN1.Click += delegate { front_Click(ImageX[I].Tag); };


You need a common method that each Image can call. Check out the ContextMenuOpeningEvent. Subscribe to each Images’ ContextMenuOpeningEvent and then if one of your Image Controls raises the event the function could assign sender to the ImageMN1.tag.

I do WinForm not WPF so I not sure how you subscribe to events. If it was WinForms I could do this.

foreach (string f in Directory.GetFiles(@MyDir, "*.jpg"))
{
     ...
     ImageX[i].OnContextMenuOpening += new EventHandlee(MyOnContextMenuOpening);
     ...
}
...

void MyOnContextMenuOpening(ContextMenuEventArgs e) 
{
     this.ImageMN1.Tag = e.sender;
}


ARon

QuestionCan I create a public object? Pin
Steve Harp12-Dec-08 3:12
Steve Harp12-Dec-08 3:12 
AnswerRe: Can I create a public object? Pin
Tom Deketelaere12-Dec-08 3:16
professionalTom Deketelaere12-Dec-08 3:16 
GeneralRe: Can I create a public object? Pin
DaveyM6912-Dec-08 3:23
professionalDaveyM6912-Dec-08 3:23 
GeneralRe: Can I create a public object? Pin
Tom Deketelaere12-Dec-08 3:45
professionalTom Deketelaere12-Dec-08 3:45 
AnswerRe: Can I create a public object? Pin
Colin Angus Mackay12-Dec-08 3:25
Colin Angus Mackay12-Dec-08 3:25 
GeneralRe: Can I create a public object? Pin
Steve Harp12-Dec-08 3:45
Steve Harp12-Dec-08 3:45 
GeneralRe: Can I create a public object? Pin
N a v a n e e t h12-Dec-08 6:48
N a v a n e e t h12-Dec-08 6:48 
AnswerRe: Can I create a public object? Pin
CodingYoshi12-Dec-08 3:28
CodingYoshi12-Dec-08 3:28 
AnswerRe: Can I create a public object? Pin
Gideon Engelberth12-Dec-08 3:47
Gideon Engelberth12-Dec-08 3:47 

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.