Chapter 8 of Victor Guadioso’s book on Blend 2 talks about Events and Event Handlers.

For those who are beginning to feel as though the stuff here in this blog is way over your head, I’ll just give a basic example of what these are.

Most don’t ever think about what has to go into a program when they’re using it. They get frustrated when a certain feature isn’t exactly what they were looking for, but the thought put towards the existing functionality and the specific elements are often overlooked.

Something most everyone is familiar with: Logging into something. You typically have 2 fields, a field for your username and a field for your password, and then a button for logging in. There are often other elements, but we’ll ignore those as they’ll make this go into the realm of “convoluted”.

So you enter your username, then you enter your password, and you click on the button.

Events and Event Handlers are the things which look for your action and interaction with that button. They “listen” for your click along with a few other things, and when you do click, they are able to execute whatever it is that the button is coded to execute.

Get it?

Most people I know don’t think about the UI when the UI is built well. They just use it. Ever come to a DVD player? Likely you have. How do you use it? Well, you hit the button which tells it to eject. How does it know to eject when you hit that button? Why someone told it to do that. How does it know to play or pause when you hit the button? Well – someone told it to do those functions. Now how did the communication get from the button to the… thing that tells it to do those things?

Anyway – One of the first things that Victor goes over is DragEnter.

As in, when you have something that you’ve clicked upon and you drag it over – as your mouse enters the area of the application, it detects that you’re dragging something into the region of the application.

My application would build, but it wouldn’t do anything when I dragged an item into it – in fact, it shows me the little icon on my mouse pointer which signified that what I was doing as an illegal action. I checked and double checked my c# but couldn’t find the issue.

I couldn’t find it, so I took a break. When I came back, the issue stuck out like a sore thumb. I neglected to add into my XAML the property AllowDrop=”True”. Ran the application and vwalla. It functioned the way it was designed.

This site uses Akismet to reduce spam. Learn how your comment data is processed.