By Fons Sonnemans, posted on

I have written a Silverlight Minesweepe game in October 2008. I just published an improved version on Silver Arcade which support right mouse click. I implemented it using the following RightMouseTrigger. You can set the SetHandled property to true. This stops the MouseRightButtonDown event from bubbling to it's parent.

I really love Behaviors, Actions and Triggers. I hope you like it too.

public class RightMouseTrigger : EventTriggerBase<Control> {

    protectedoverridestring GetEventName() {



    #region SetHandled Dependency Property


    /// Get or Sets the SetHandled dependency property. 


    publicbool SetHandled {

        get { return (bool)GetValue(SetHandledProperty); }

        set { SetValue(SetHandledProperty, value); }



    /// Identifies the SetHandled dependency property.

    /// This enables animation, styling, binding, etc...


    publicstaticreadonlyDependencyProperty SetHandledProperty =





    #endregion SetHandled Dependency Property

    protectedoverridevoid OnEvent(EventArgs eventArgs) {

        var ea = eventArgs asMouseButtonEventArgs;

        if (ea != null && SetHandled) {

            ea.Handled = true;





All postings/content on this blog are provided "AS IS" with no warranties, and confer no rights. All entries in this blog are my opinion and don't necessarily reflect the opinion of my employer or sponsors. The content on this site is licensed under a Creative Commons Attribution By license.

Leave a comment

Blog comments

0 responses