Esempio n. 1
0
        public override NSView GetCell(Cell item, NSView reusableView, NSTableView tv)
        {
            var x = (NativeCell)item;

            Console.WriteLine(x);

            NativeMacOsCell c = reusableView as NativeMacOsCell;

            if (c == null)
            {
                c = new NativeMacOsCell(s_rid);
            }

            NSImage i = null;

            if (!string.IsNullOrWhiteSpace(x.ImageFilename))
            {
                i = new NSImage("Images/" + x.ImageFilename + ".jpg");
            }

            base.WireUpForceUpdateSizeRequested(item, c, tv);

            c.UpdateCell(x.Name, x.Category, i);

            return(c);
        }
Esempio n. 2
0
        public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, nint row)
        {
            NativeMacOsCell cell = tableView.MakeView(_cellIdentifier, tableView) as NativeMacOsCell;

            if (cell == null)
            {
                cell = new NativeMacOsCell(_cellIdentifier);
            }
            int rowNumber = (int)row;

            if (string.IsNullOrWhiteSpace(_tableItems[rowNumber].ImageFilename))
            {
                cell.UpdateCell(_tableItems[rowNumber].Name
                                , _tableItems[rowNumber].Category
                                , null);
            }
            else
            {
                cell.UpdateCell(_tableItems[rowNumber].Name
                                , _tableItems[rowNumber].Category
                                , new NSImage("Images/" + _tableItems[rowNumber].ImageFilename + ".jpg"));
            }

            return(cell);
        }