The row/field of a database table is encapsulated in a class called DataContext. So setSelectedItem will never "see" a null value only a DataContext object. A custom Dictionary (DataContextList) is used for ListButtons' list data. When setSelecteItem is called on a ListButton from TableViewRowEditor a DataContext instance is passed as the argument. This is passed to DataContextList.indexOf. As the ListButtons' list data does not contain a DataContext that references a null value, -1 is returned.
If it is important that setSelectedItem throws the exception I can just subclass the ListButton to get the behaviour I need. On Tue, 15 Sep 2009 09:31:54 am Greg Brown wrote: > > I modified setSelectedItem to not throw an exception if the object > > was not > > found in the lists' data. > > For any item value, or just null? I think null makes sense, though I > do think an exception is justified otherwise. > > Note that you can set the button data to a value that is not in the > list. Maybe that would help?
