Can anyone help me
solving this problem?
I have button control
that is added on itemcontrol from codebehind but event doesn't fire.
My code is below.
you in advance.
I tried adding a button from code to a listbox. I found that the mouseLeftButtonUp was not firing, as it is just a mouse button event, whereas click event was firing as it is a routed event.
So making use of a routed event handler would solve your problem .
Here's my code
Button b = new Button();
b.Width = 30;
b.Height = 30;
b.MouseLeftButtonUp += new MouseButtonEventHandler(b_MouseLeftButtonUp);
void b_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
void b_Click(object sender, RoutedEventArgs e)
So try using the click event for the button . If you want to know more about routed events and why they will work, then please read
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?