Skip to content →

Tag: addhandler

Unhandling previously handled events in Silverlight


You may well find yourself wanting to attach to an event which has already been handled inside a control with no way to override and prevent the event from being handled. As seen in my prior post to this, you can make use of the AddHandler method. I am going to use the Backspace key down in a TextBox as an example, the event is only raised and not handled when the TextBox is empty. (This can be seen in the sample application in the output coming from the behavior)

Leave a Comment

Detect whether the mouse is down in Silverlight

After recently searching for a way to do this and finding nothing I thought I would share a solution. It involves using the ever useful AddHandler method on the UIElement you wish to detect the mouse down on and simply setting a flag. Job done.

It is worth noting that popups and child windows may appear on top of the UIElement which the handler is attached to.