public void AddOption(object options, ObjValueLabelHint hint) { if (hint == null) { hint = new ObjValueLabelHint(); } if (string.IsNullOrEmpty(hint.Category)) { hint.Category = Zen.Utilities.Text.NameCleaner.ToPhrase(options.GetType().Name); } _optionsList.Add(new Pair <object, ObjValueLabelHint>(options, hint)); }
/// <summary> /// Set object and return leaf item count /// </summary> /// <param name="obj">Any object that exposes public properties</param> /// <param name="valueHints">Value hint by property name</param> public int SetObject(object obj, ObjValueLabelHint objHints, CellBorderStyle borderStyle) { if (_object == obj) { return(_controlMap.Count); } _object = obj; _objHints = (objHints != null)? objHints: new ObjValueLabelHint(); _borderStyle = borderStyle; if (_objType != obj.GetType()) { BuildCompositeCtrl(_object.GetType(), _object, null); DrawControls(); _objType = obj.GetType(); } else // load data only, no need to rebuild / redraw controls { LoadComposite(_objType, obj, null); } return(_controlMap.Count); }