I have a treeview that I want to come with certain collections. I'm having trouble getting my collections to persist, I suspect because they have default values. Am I correct? Anything I can do? What follows is some code:
[TypeConverterAttribute(typeof(System.ComponentModel.ExpandableObjectConverter))] public class NumberCriterion { private string _Title, _Format; private bool _Multi; public NumberCriterion() { } public override string ToString() { return _Title ?? base.ToString(); } [DisplayName("Title")] [Description("The unique title of the criterion.")] public string Title { get { return _Title; } set { _Title = value; } } [DisplayName("Format")] [Description("The criterion format. {0} is the field name. {1} is the value. {2} is the optional additional value.")] public string Format { get { return _Format; } set { _Format = value; } } [DisplayName("Multi")] [Description("Indicates that the user specifies two values.")] public bool Multi { get { return _Multi; } set { _Multi = value; } } [Browsable(true)] public NumberCriterion(string Title, string Format, bool Multi = false) { _Title = Title; _Format = Format; _Multi = Multi; } }
static NumberCriterion ncRdlEquivalency = new NumberCriterion("Is", "Fields!{0}.Value = {1}"); static NumberCriterion ncRdlSucceeds = new NumberCriterion("More than", "Fields!{0}.Value > {1}"); static NumberCriterion ncRdlPreceeds = new NumberCriterion("Less than", "Fields!{0}.Value < {1}"); static NumberCriterion ncRdlBetween = new NumberCriterion("Between", "(Fields!{0}.Value >= {1} AND Fields!{0}.Value <= {2})", true); static NumberCriterion[] RdlNumberCriteria = new NumberCriterion[] { ncRdlEquivalency, ncRdlSucceeds, ncRdlPreceeds, ncRdlBetween };
[Browsable(true)] [Editor(typeof(System.ComponentModel.Design.CollectionEditor), typeof(System.Drawing.Design.UITypeEditor))] [Category("Criteria"), DisplayName("Numbers")] public List<NumberCriterion> NumberCriteria { get { return NumberFormatList ?? RdlNumberCriteria.ToList(); } }
Thank you in advance.