4

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?

Avo Muromägi
  • 1,563
  • 1
  • 12
  • 21
  • Try inheriting the interface from IInvokable or add $M+ compiler switch to add the RTTI. Anyway I think LiveBindings cannot work with interfaces but I am not sure. – Stefan Glienke Jan 25 '12 at 22:43
  • @StefanGlienke Unfortunately that did not work. I wonder if there's any particular reason, why Embarcadero didn't make it work with interfaces. – Avo Muromägi Jan 25 '12 at 23:24

0 Answers0