Why is my Button event is not occuring?

IsHitTestVisible="False" for the ListBox is disabling the click event for the Button. It makes all content within the ListBox invisible to hit-test as well.

Up vote 0 down vote favorite share g+ share fb share tw.

I am having an issue with my button event not occuring Basically I have cart items that are listed in the listbox. When the delete button is clicked then the item is deleted from the list box. I tried debugging, but it seems to not even call the method for when the button is clicked.

In my ticketscreen. Xaml file I specify my button in the template: ... X ... My List box is the following: My method removeCartItem is in the ticketscreen.xaml. Cs: private void removeCartItem(object sender, RoutedEventArgs e) { Console.

WriteLine("TestingCartRemove"); } Am I missing something obvious? Thx in adv! :) Edit: There seems to be something infront of it... maybe the listbox?

How do I make it so that I am not clicking the ListBox, but I can click on things within the Stackpanel, which are contents of the list box. C# wpf events button link|improve this question edited Dec 1 '10 at 20:38 asked Dec 1 '10 at 20:02Aero Chocolate18812 92% accept rate.

Yeah, I just saw it! Thanks! – Aero Chocolate Dec 2 '10 at 6:51.

Maybe you haven't seen the output in Visual Studio Output Window. Try to call a MessageBox. Show("Test"); instead.

You have a listbox control, which leads me to believe that this is not a console application. Therefore, Console.WriteLine() will not show you anything. Try MessageBox.Show() instead.

Good point but the OP states "I tried debugging," so we have to assume he set a break point in removeCartItem and it doesn't get hit. – ChrisF Dec 1 '10 at 20:12 Well, I figured I'd start with answering "Am I missing something obvious" – Mark Avenius Dec 1 '10 at 20:13 Yeah I set a breakpoint and it didn't stop there – Aero Chocolate Dec 1 '10 at 20:18.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions