A sfComboBox with a SortedSet of named tuples will throw an exception when .ValueMember and .DisplayMember set.
Designer settings
- DropDownStyle is DropDownList
- AllowSelectAll is true
- ComboBoxMode is MultiSelection
The following will throw an Exception "System.NullReferenceException: 'Object reference not set to an instance of an object.'
" when the drop down list opened by user.
Dates = new SortedSet<(DateTime val,string show)>();
DateTime dt;
dt = DateTime.Parse("01/01/2019 12:00:00"); Dates.Add((val: dt, show: dt.ToString("D")));
dt = DateTime.Parse("02/01/2019 12:00:00"); Dates.Add((val: dt, show: dt.ToString("D")));
dt = DateTime.Parse("01/15/2019 12:00:00"); Dates.Add((val: dt, show: dt.ToString("D")));
sf_comboBox1.DataSource = Dates;
sf_comboBox1.ValueMember = "val";
sf_comboBox1.DisplayMember = "show";
When the member settings are not assigned, the drop down list shows check boxes with the tuple rendering (without names)
☐ Select All
☐ (01/01/2019 12:00:00 PM, Tuesday, January 1, 2019)
☐ (01/15/2019 12:00:00 PM, Tuesday, January 15, 2019)
☐ (02/01/2019 12:00:00 PM, Friday, February, 2019)
What I want in the drop down list is just the "D" formatted datetime without parenthesis