private void OnUIACollectionChanged (object sender, CollectionChangeEventArgs args)
{
if (lastCurrencyManager == null || args.Action == CollectionChangeAction.Refresh)
return;
// FIXME: Remove CurrentTableStyle property after committing SWF patch
SWF.DataGridTableStyle tableStyle = CurrentTableStyle;
CreateHeader (tableStyle);
if (args.Action == CollectionChangeAction.Add) {
if (tableStyle.GridColumnStyles.Count == 0)
return;
for (int index = items.Count; index < lastCurrencyManager.Count; index++)
CreateListItem (index, tableStyle);
} else if (args.Action == CollectionChangeAction.Remove) {
// TODO: Is there a better way to do this?
int toRemove = items.Count - lastCurrencyManager.Count;
while (toRemove > 0) {
ListItemProvider item = items [items.Count - 1];
RemoveChildProvider (item);
item.Terminate ();
items.Remove (item);
toRemove--;
}
}
}