DataContext does implement Dictionary. I got mixed up before when I wrote that 
DataContextList is a Dictionary, it is in fact a List. DataContext does 
represent a row but it also can represent a single field in that row. It 
overrides toString so it can also be used in ListView/ListButton.

On Tue, 15 Sep 2009 10:08:20 am Greg Brown wrote:
> So, if I understand you correctly, DataContext represents a row - yes?
> If so:
>
> - Are you trying to use binding to populate the fields in your row
> editor?
> - Does DataContext implement Dictionary?
>
> On Sep 14, 2009, at 7:46 PM, Scott Lanham wrote:
> > 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?

Reply via email to