Linking of a data source with TListBox with headers by LiveBindings does not work

  

I was coding an FMX metropolis application in Delphi XE5 and met the error in synchronization of datasource and TListBox. It works properly until there is a group header that unites one or more items. The selection of the first item of ListBox (ListItemStyle=MetropolisUI) in a group leads to its disappearing from the list (it becomes invisible, this does not effect the dataset itself).

object LinkListControlToField1: TLinkListControlToField
Category = ‘Quick Bindings’
DataSource = BindSourceDB1
FieldName = ‘name2’
Control = ListBox1
FillExpressions = <
item
SourceMemberName = ‘photo_mini’
ControlMemberName = ‘Icon’
end
item
SourceMemberName = ‘diagnosis_short’
ControlMemberName = ‘Description’
end
item
ControlMemberName = ‘Title’
CustomFormat = ‘self.owner.name1.text+” “+self.owner.name2.text’
end>
ListItemStyle = ‘MetropolisUI’
AutoBufferCount = False
FillHeaderExpressions = <>
FillBreakFieldName = ‘ward’
FillHeaderCustomFormat = ‘”Ward “+ward.text’
FillBreakGroups = <>
end
end

The following simplified project that I used to reproduce the error is acting in a different way but the matter of the problem is almost the same. We need only a form with PrototypeBindSource1: TPrototypeBindSource; (generating literal and integer fields), BindingsList1: TBindingsList; ListBox1: TListBox; and Edit1: TEdit; Here is the LiveBindings link:

object BindingsList1: TBindingsList
Methods = <>
OutputConverters = <>
Left = 20
Top = 5
object LinkListControlToField1: TLinkListControlToField
Category = ‘Quick Bindings’
DataSource = PrototypeBindSource1
FieldName = ‘ContactName1’
Control = ListBox1
FillExpressions = <>
AutoBufferCount = False
FillHeaderExpressions = <>
FillHeaderFieldName = ‘UIntField1’
FillBreakGroups = <>
end
object LinkControlToField1: TLinkControlToField
Category = ‘Quick Bindings’
DataSource = PrototypeBindSource1
FieldName = ‘ContactName1’
Control = Edit1
Track = False
end

Selection of items do not correspond to the id of the selected record in the DataSource (DataSet). It seems that the LiveBindings engine synchronizes ItemIndex property of the TListBox but not the real id of the selected record. Is there any correct way out to resolve the issue?

Comments are closed.