コード例 #1
0
        /// <summary>
        /// Creates the property descriptor for a specfic view model based on an existing property descriptor.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="propertyDescriptor">The property descriptor.</param>
        /// <returns>The <see cref="ViewModelPropertyDescriptor" />.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="propertyDescriptor" /> is <c>null</c>.</exception>
        public static ViewModelPropertyDescriptor CreatePropertyDescriptor(ViewModelBase viewModel, ViewModelPropertyDescriptor propertyDescriptor)
        {
            Argument.IsNotNull("propertyDescriptor", propertyDescriptor);

            var attributes = new List<Attribute>();
            if (propertyDescriptor.Attributes != null)
            {
                foreach (var attribute in propertyDescriptor.Attributes)
                {
                    var attrib = attribute as Attribute;
                    if (attrib != null)
                    {
                        attributes.Add(attrib);
                    }
                }
            }

            return CreatePropertyDescriptor(viewModel, propertyDescriptor.Name, propertyDescriptor.PropertyType, attributes.ToArray());
        }
コード例 #2
0
        /// <summary>
        /// Creates the property descriptor for a specfic view model based on an existing property descriptor.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="propertyDescriptor">The property descriptor.</param>
        /// <returns>The <see cref="ViewModelPropertyDescriptor" />.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="propertyDescriptor" /> is <c>null</c>.</exception>
        public static ViewModelPropertyDescriptor CreatePropertyDescriptor(ViewModelBase viewModel, ViewModelPropertyDescriptor propertyDescriptor)
        {
            Argument.IsNotNull("propertyDescriptor", propertyDescriptor);

            var attributes = new List <Attribute>();

            if (propertyDescriptor.Attributes != null)
            {
                foreach (var attribute in propertyDescriptor.Attributes)
                {
                    var attrib = attribute as Attribute;
                    if (attrib != null)
                    {
                        attributes.Add(attrib);
                    }
                }
            }

            return(CreatePropertyDescriptor(viewModel, propertyDescriptor.Name, propertyDescriptor.PropertyType, attributes.ToArray()));
        }
コード例 #3
0
        /// <summary>
        /// Creates the property descriptor for a specfic view model based on an existing property descriptor.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="propertyDescriptor">The property descriptor.</param>
        /// <returns>The <see cref="ViewModelPropertyDescriptor"/>.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="propertyDescriptor"/> is <c>null</c>.</exception>
        public static ViewModelPropertyDescriptor CreatePropertyDescriptor(ViewModelBase viewModel, ViewModelPropertyDescriptor propertyDescriptor)
        {
            Argument.IsNotNull("propertyDescriptor", propertyDescriptor);

            return(CreatePropertyDescriptor(viewModel, propertyDescriptor.Name, propertyDescriptor.PropertyType));
        }
コード例 #4
0
        /// <summary>
        /// Creates the property descriptor for a specfic view model based on an existing property descriptor. 
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="propertyDescriptor">The property descriptor.</param>
        /// <returns>The <see cref="ViewModelPropertyDescriptor"/>.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="propertyDescriptor"/> is <c>null</c>.</exception>
        public static ViewModelPropertyDescriptor CreatePropertyDescriptor(ViewModelBase viewModel, ViewModelPropertyDescriptor propertyDescriptor)
        {
            Argument.IsNotNull("propertyDescriptor", propertyDescriptor);

            return CreatePropertyDescriptor(viewModel, propertyDescriptor.Name, propertyDescriptor.PropertyType);
        }