delphi 中的实时绑定接口
我使用 Delphi FireMonkey 平台创建了一个小项目来尝试新的实时绑定功能。我想用项目 TList
填充 TListBox 并使用 BOCollection 示例。 BindList.FormatExpressions[0]
的值与示例中的值类似。
ControlExpression = 'Text'
SourceExpression = 'Current.Name'
现在,如果我调用 BindList.FillList
则会收到异常“无法找到名称”。但是,如果我使用对象列表(TList
而不是 TList
),则不会引发异常,并且列表会正确填充 - 它可以工作!所以看来LiveBinding无法找到接口的属性。
IFoo 的定义如下:
IFoo = interface
function GetName: string;
procedure SetName(const AValue: string);
property Name: string read GetName write SetName;
end;
是否可以使实时绑定与接口一起工作?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论