/// <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();
            }
            if (string.IsNullOrEmpty(e.NewValue.ToString()))
            {
                return;
            }
            //bind the new event to the command
            if (!e.NewValue.ToString().Contains(","))
            {
                binding.BindEvent(d, e.NewValue.ToString());
            }
            else
            {
                string[] events = e.NewValue.ToString().Split(',');
                foreach (string eventStr in events)
                {
                    binding.BindEvent(d, eventStr);
                }
            }
        }