private void OnSelectedCollectionChange(object sender, EventArgs <CollectionReference> e)
        {
            if (listCollectionTable == null)
            {
                return;
            }

            while (listCollectionTable.ColumnCount > 0)
            {
                listCollectionTable.RemoveColumn(listCollectionTable.TableColumns().Last());
            }

            if (e.Data != null)
            {
                var keys = new List <string>();
                foreach (var item in e.Data.Items)
                {
                    keys = item.LiteDocument.Keys.Union(keys).ToList();
                }

                foreach (var key in keys)
                {
                    var tableColumn = new NSTableColumn
                    {
                        HeaderCell =
                        {
                            Title = key
                        },
                        Identifier = key
                    };
                    listCollectionTable.AddColumn(tableColumn);
                }
            }

            var dataSource = new ListCollectionTableDataSource(e.Data);

            listCollectionTable.DataSource = dataSource;
            listCollectionTable.Delegate   = new ListCollectionTableDelegate(dataSource);
            listCollectionTable.Menu       = listCollectionMenu;
        }
 public ListCollectionTableDelegate(ListCollectionTableDataSource dataSource)
 {
     DataSource = dataSource;
 }