示例#1
0
        public void UpdateColumn(ListViewColumn col, object handle, ListViewColumnChange change)
        {
            NSTableColumn tcol = (NSTableColumn)handle;

            switch (change)
            {
            case ListViewColumnChange.CanResize:
                tcol.ResizingMask = col.CanResize ? NSTableColumnResizing.UserResizingMask : NSTableColumnResizing.Autoresizing;
                break;

            case ListViewColumnChange.Cells:
                var c = CellUtil.CreateCell(ApplicationContext, Table, this, col.Views, cols.IndexOf(tcol));
                c.Alignment   = col.Alignment.ToNSTextAlignment();
                tcol.DataCell = c;
                break;

            case ListViewColumnChange.Title:
                tcol.HeaderCell.Title = col.Title ?? string.Empty;
                if (!col.CanResize)
                {
                    tcol.SizeToFit();
                }
                break;

            case ListViewColumnChange.Alignment:
                tcol.HeaderCell.Alignment = col.Alignment.ToNSTextAlignment();
                break;
            }
        }
示例#2
0
        public virtual NSTableColumn AddColumn(ListViewColumn col)
        {
            var tcol = new NSTableColumn();

            tcol.Editable = true;
            cols.Add(tcol);
            var c = CellUtil.CreateCell(ApplicationContext, Table, this, col.Views, cols.Count - 1);

            tcol.DataCell = c;
            Table.AddColumn(tcol);
            var hc = new NSTableHeaderCell();

            hc.Title                  = col.Title ?? "";
            tcol.HeaderCell           = hc;
            tcol.HeaderCell.Alignment = col.Alignment.ToNSTextAlignment();
            tcol.ResizingMask         = col.CanResize ? NSTableColumnResizing.UserResizingMask : NSTableColumnResizing.Autoresizing;
            tcol.SizeToFit();
            Widget.InvalidateIntrinsicContentSize();
            return(tcol);
        }