/// <summary> /// Wires the trigger into the interactin hierarchy. /// </summary> /// <param name="node">The node.</param> public override void Attach(IInteractionNode node) { InputGesture gesture; if (Key != Key.None) { gesture = new UnrestrictedKeyGesture(Key, Modifiers); } else { gesture = new MouseGesture(MouseAction, Modifiers); } var uiElement = node.UIElement as UIElement; if (uiElement == null) { var ex = new CaliburnException( string.Format( "You cannot use a GestureMessageTrigger with an instance of {0}. The source element must inherit from UIElement.", node.UIElement.GetType().FullName ) ); Log.Error(ex); throw ex; } FindOrCreateLookup(uiElement, gesture) .AddTrigger(this); base.Attach(node); }
/// <summary> /// Wires the trigger into the interactin hierarchy. /// </summary> /// <param name="node">The node.</param> public override void Attach(IInteractionNode node) { InputGesture gesture; if(Key != Key.None) gesture = new UnrestrictedKeyGesture(Key, Modifiers); else gesture = new MouseGesture(MouseAction, Modifiers); var uiElement = node.UIElement as UIElement; if(uiElement == null) { var ex = new CaliburnException( string.Format( "You cannot use a GestureMessageTrigger with an instance of {0}. The source element must inherit from UIElement.", node.UIElement.GetType().FullName ) ); Log.Error(ex); throw ex; } FindOrCreateLookup(uiElement, gesture) .AddTrigger(this); base.Attach(node); }