예제 #1
0
        void itm_OnPropValueChanged(APropItem sender, IPropGWAble setee, PropertyInfo pi, object value)
        {
            int index = (int)sender.AttrParam;

            _Values[index] = value;
            setee.SetProp(pi, _Values);
        }
예제 #2
0
        public override FrameworkElement GetControl()
        {
            DockPanel dp = new DockPanel();

            dp.Margin = new Thickness(6);
            Label lbl = new Label();

            lbl.VerticalAlignment = VerticalAlignment.Center;
            lbl.Content           = _Attr.FriendlyName + ":";
            DockPanel.SetDock(lbl, Dock.Left);
            dp.Children.Add(lbl);
            StackPanel sp = new StackPanel();

            dp.Children.Add(sp);

            SubPropAttribute[] attrs = (SubPropAttribute[])_PI.GetCustomAttributes(typeof(SubPropAttribute), true);
            _Values   = (object[])_Ctrl.GetProp(_PI);
            _SubItems = new APropItem[_Values.Length];
            foreach (var x in attrs)
            {
                PropDiscribeAttribute a   = new PropDiscribeAttribute(x.ShowType, x.FriendlyName, x.Describe, x.Param);
                APropItem             itm = PropItemFactory.GetPropItem(a, _Ctrl, _PI);
                sp.Children.Add(itm.GetControl());
                itm.SetPropShowValue(_Values[(int)itm.AttrParam]);
                itm.TimeToShowHelpString += itm_TimeToShowHelpString;
                itm.AutoSet                   = false;
                itm.OnPropValueChanged       += itm_OnPropValueChanged;
                _SubItems[(int)itm.AttrParam] = itm;
            }
            return(dp);
        }