コード例 #1
0
        public static int GetColumnWidth(MemberInfo memberInfo)
        {
            int result = (int)ReflectionUtil.GetAttributePropertyValue(memberInfo, typeof(EntityColumnAttribute), "Width");


            return(result);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.propertyGrid = new Grid();
            this.Content      = this.propertyGrid;
            PropertyInfo[] pvmInfo = typeof(LaptopViewModel).GetProperties();

            this.commandPanel                     = new StackPanel();
            this.commandPanel.Orientation         = Orientation.Horizontal;
            this.commandPanel.HorizontalAlignment = HorizontalAlignment.Right;
            this.commandPanel.Margin              = new Thickness(0, 5, 10, 10);

            var sortedPvmInfo =
                from p in pvmInfo
                where DisplayUtil.HasControl(p)
                orderby DisplayUtil.GetControlSequence(p)
                select p;

            foreach (PropertyInfo p in sortedPvmInfo)
            {
                object object1 = ReflectionUtil.GetAttributePropertyValue(p, typeof(EntityControlAttribute), p.Name.ToString());

                this.BuildLabeledControl(p);
            }

            RowDefinition rowDefinition = new RowDefinition();

            rowDefinition.Height = GridLength.Auto;
            this.propertyGrid.RowDefinitions.Add(rowDefinition);
            Grid.SetRow(this.commandPanel, this.propertyGrid.RowDefinitions.Count);
            this.propertyGrid.Children.Add(this.commandPanel);
        }
コード例 #3
0
        public static int GetControlSequence(MemberInfo memberInfo)
        {
            int result = (int)ReflectionUtil.GetAttributePropertyValue(memberInfo, typeof(EntityControlAttribute), "Sequence");



            return(result);
        }
コード例 #4
0
        public static ControlType GetControlType(PropertyInfo propertyInfo)
        {
            object result = ReflectionUtil.GetAttributePropertyValue(propertyInfo, typeof(EntityControlAttribute), "ControlType");

            if (result == null)
            {
                result = ControlType.None;
            }

            return((ControlType)result);
        }
コード例 #5
0
 public static string GetAttributePropertyValueAsString(MemberInfo memberInfo, Type attributeType, string propertyName)
 {
     return(ReflectionUtil.GetAttributePropertyValue(memberInfo, attributeType, propertyName).ToString());
 }