Ejemplo n.º 1
0
        public static void SetHandlers(DependencyObject owner, CommandHandlerCollectionBinding commands)
        {
            owner.SetValue(HandlersProperty, commands);
            var collection = commands as INotifyCollectionChanged;

            if(collection != null)
            {
                collection.CollectionChanged += CommandHandlersCollectionChanged;
            }
        }
Ejemplo n.º 2
0
        public static CommandHandlerCollectionBinding GetHandlers(DependencyObject owner)
        {
            if(owner == null)
            {
                throw new ArgumentNullException("owner");
            }

            var collection = owner.GetValue(HandlersProperty) as CommandHandlerCollectionBinding;

            if(collection == null)
            {
                collection = new CommandHandlerCollectionBinding
                                 {
                                     Owner = owner
                                 };

                SetHandlers(owner, collection);
            }

            return collection;
        }