コード例 #1
0
        /// <summary>
        /// Searches the view model for properties marked with the <see cref="VueDataBindingAttribute"/>.
        /// </summary>
        /// <param name="viewModel">View model to search.</param>
        /// <returns>Enumeration of found propertie with their binding information.</returns>
        private IEnumerable <VueBindingDescription> DetectMarkedViewmodelAttributes(object viewModel)
        {
            Type type = viewModel.GetType();

            PropertyInfo[] props = type.GetProperties();
            foreach (PropertyInfo prop in props)
            {
                VueDataBindingAttribute bindingAttribute = prop.GetCustomAttribute <VueDataBindingAttribute>();
                if (bindingAttribute != null)
                {
                    VueBindingMode bindingMode = bindingAttribute.BindingMode;
                    if (prop.PropertyType == typeof(ICommand))
                    {
                        bindingMode = VueBindingMode.Command;
                    }

                    yield return(new VueBindingDescription(prop.Name, bindingMode));
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VueBindingDescription"/> class.
 /// </summary>
 /// <param name="propertyName">Sets the <see cref="PropertyName"/>.</param>
 /// <param name="bindingMode">Sets the <see cref="BindingMode"/>.</param>
 public VueBindingDescription(string propertyName, VueBindingMode bindingMode)
 {
     PropertyName = propertyName;
     BindingMode  = bindingMode;
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VueDataBindingAttribute"/> class.
 /// </summary>
 /// <param name="bindingMode">Sets the <see cref="BindingMode"/>.</param>
 public VueDataBindingAttribute(VueBindingMode bindingMode)
 {
     BindingMode = bindingMode;
 }