/// <summary> /// Sets the behaviour property. /// </summary> private static void Setbehaviour(DependencyObject d, CommandBehaviourBinding value) { d.SetValue(behaviourProperty, value); }
//tries to get a CommandBehaviourBinding from the element. Creates a new instance if there is not one attached private static CommandBehaviourBinding FetchOrCreateBinding(DependencyObject d) { CommandBehaviourBinding binding = CommandBehaviour.Getbehaviour(d); if (binding == null) { binding = new CommandBehaviourBinding(); CommandBehaviour.Setbehaviour(d, binding); } return binding; }