Exemplo n.º 1
0
        public virtual void SetSource(IListDataSource source, IBackend sourceBackend)
        {
            this.source = source;

            RowHeights = new List <nfloat> ();
            for (int i = 0; i < source.RowCount; i++)
            {
                RowHeights.Add(-1);
            }

            tsource          = new ListSource(source);
            Table.DataSource = tsource;

            //TODO: Reloading single rows would be slightly more efficient.
            //      According to NSTableView.ReloadData() documentation,
            //      only the visible rows are reloaded.
            source.RowInserted += (sender, e) => {
                RowHeights.Insert(e.Row, -1);
                Table.ReloadData();
            };
            source.RowDeleted += (sender, e) => {
                RowHeights.RemoveAt(e.Row);
                Table.ReloadData();
            };
            source.RowChanged += (sender, e) => {
                UpdateRowHeight(e.Row);
                Table.ReloadData(NSIndexSet.FromIndex(e.Row), NSIndexSet.FromNSRange(new NSRange(0, Table.ColumnCount)));
            };
            source.RowsReordered += (sender, e) => { RowHeights.Clear(); Table.ReloadData(); };
        }
Exemplo n.º 2
0
        public virtual void SetSource(IListDataSource source, IBackend sourceBackend)
        {
            this.source      = source;
            tsource          = new ListSource(source);
            Table.DataSource = tsource;

            //TODO: Reloading single rows would be slightly more efficient.
            //      According to NSTableView.ReloadData() documentation,
            //      only the visible rows are reloaded.
            source.RowInserted   += (sender, e) => Table.ReloadData();
            source.RowDeleted    += (sender, e) => Table.ReloadData();
            source.RowChanged    += (sender, e) => Table.ReloadData();
            source.RowsReordered += (sender, e) => Table.ReloadData();
        }
Exemplo n.º 3
0
 public void SetSource(IListDataSource source, IBackend sourceBackend)
 {
     this.source      = source;
     tsource          = new ListSource(source);
     Table.DataSource = tsource;
 }