/// <summary> /// Handles changes to the Event property. /// </summary> private static void OnEventChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CommandBehaviorBinding binding = FetchOrCreateBinding(d); //check if the Event is set. If yes we need to rebind the Command to the new event and unregister the old one if (binding.Event != null && binding.Owner != null) { binding.Dispose(); } //bind the new event to the command binding.BindEvent(d, e.NewValue.ToString()); }
/// <summary> /// Handles changes to the Action property. /// </summary> private static void OnActionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { //Console.WriteLine("11111111111111"); var _32 = d.GetBindingExpression(Mvc.ActionProperty); CommandBehaviorBinding binding = FetchOrCreateBinding(d); if (_32 != null) { var _bindname = _32.ParentBinding.Path.Path; binding.ActionName = _bindname.Substring(_bindname.LastIndexOf('.') + 1); } binding.Action = (ActionResult)e.NewValue; if (binding.Owner != null) { if (!binding.IsLockOwner) { binding.AppFirstLoad(); } binding.IsLockOwner = true; } }
private static void OnIsSendEventArgsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CommandBehaviorBinding binding = FetchOrCreateBinding(d); binding.IsSendEventArgs = (bool)e.NewValue; }
/// <summary> /// Sets the Behavior property. /// </summary> private static void SetBehavior(DependencyObject d, CommandBehaviorBinding value) { d.SetValue(BehaviorProperty, value); }
/// <summary> /// Handles changes to the CommandParameter property. /// </summary> private static void OnParameterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CommandBehaviorBinding binding = FetchOrCreateBinding(d); binding.CommandParameter = e.NewValue; }