Пример #1
0
        /// <summary>
        /// Removes a child resolver.
        /// </summary>
        /// <param name="resolver">The resolver to remove.</param>
        /// <returns>true, when the resolver was (found and) removed.</returns>
        public static bool RemoveChildResolver(ChildResolver resolver)
        {
            if (resolver == null)
            {
                throw new ArgumentNullException("resolver");
            }

            return(ChildResolvers.Remove(resolver));
        }
Пример #2
0
        /// <summary>
        /// Adds a child resolver.
        /// </summary>
        /// <param name="filter">The type filter.</param>
        /// <param name="resolver">The resolver.</param>
        public static ChildResolver AddChildResolver <T>(Func <T, IEnumerable <DependencyObject> > resolver) where T : DependencyObject
        {
            if (resolver == null)
            {
                throw new ArgumentNullException("resolver");
            }

            NonResolvableChildTypes.Clear();

            var childResolver = new ChildResolver <T>(resolver);

            ChildResolvers.Add(childResolver);

            return(childResolver);
        }
Пример #3
0
        /// <summary>
        /// Adds a child resolver.
        /// </summary>
        /// <param name="filter">The type filter.</param>
        /// <param name="resolver">The resolver.</param>
        public static ChildResolver AddChildResolver(Func <Type, bool> filter, Func <DependencyObject, IEnumerable <DependencyObject> > resolver)
        {
            if (filter == null)
            {
                throw new ArgumentNullException("filter");
            }

            if (resolver == null)
            {
                throw new ArgumentNullException("resolver");
            }

            NonResolvableChildTypes.Clear();

            var childResolver = new ChildResolver(filter, resolver);

            ChildResolvers.Add(childResolver);

            return(childResolver);
        }