Livebinding interfaces in delphi

820 Views Asked by At

I created a small project using Delphi FireMonkey platform to try out the new live bindings feature. I want to populate TListBox with items TList<IFoo> and I use BOCollection example. BindList.FormatExpressions[0] has values similar to the ones in the example.

ControlExpression = 'Text'
SourceExpression = 'Current.Name'

Now, if I call BindList.FillList then I get the exception "Couldn't find Name". However, if I use list of objects (TList<TFoo> instead of TList<IFoo>) then there's no exception raised and list is populated correctly - it works! So it seems that livebinding can't find properties of interfaces.

Definition of IFoo is the following:

IFoo = interface
  function GetName: string;
  procedure SetName(const AValue: string);
  property Name: string read GetName write SetName;
end;

Is it possible to make livebinding work with interfaces?

0

There are 0 best solutions below