osx - Xamarin NSTableView hide columns, color specific cells, color specific rows -


i'm trying implement nstableview in project , fill specific data. works quite fine. now, want able, hide columns, color specific cells, or color specific rows. made similar in java, don't know to in xamarin:mac.

here code delegate:

public class mp3filetabledelegate : nstableviewdelegate {      private const string cellidentifier = "filecell";      private mp3filedatasource datasource;      public mp3filetabledelegate (mp3filedatasource datasource) {         this.datasource = datasource;     }      public override nsview getviewforitem (nstableview tableview, nstablecolumn tablecolumn, nint row) {         // pattern allows reuse existing views when no-longer in use.         // if returned view null, instance new view         // if non-null view returned, modify enough reflect new data         nstextfield view = (nstextfield)tableview.makeview (cellidentifier, this);         if (view == null) {             view = new nstextfield ();             view.identifier = cellidentifier;             view.backgroundcolor = nscolor.clear;             view.bordered = false;             view.selectable = false;             view.editable = true;             view.editingended += (sender, e) => {                 setnewvalueinmp3file (datasource.audiofiles [(int)row], tablecolumn, view.stringvalue);             };         }          audiofile audiofile = datasource.audiofiles [(int)row];          // setup view based on column selected         switch (tablecolumn.title) {         case "path":             view.stringvalue = audiofile.getpathwithfilename ();             break;         }         if (audiofile.gettype () == typeof(mp3file)) {             mp3file mp3file = (mp3file)audiofile;              switch (tablecolumn.title) {             case "artist":                 view.stringvalue = mp3file.artist;                 break;             case "title":                 view.stringvalue = mp3file.title;                 break;             case "album":                 view.stringvalue = mp3file.album;                 break;             case "bpm":                 view.stringvalue = mp3file.bpm;                 break;             case "comment":                 view.stringvalue = mp3file.comment;                 break;             case "year":                 view.stringvalue = mp3file.year;                 break;             case "key":                 view.stringvalue = mp3file.initialkey;                 break;             case "quality":                 view.stringvalue = mp3file.album;                 break;             case "length":                 view.stringvalue = mp3file.album;                 break;             }         }         return view;     }       private void setnewvalueinmp3file (audiofile file, nstablecolumn tablecolumn, string value) {          if (file.gettype () == typeof(mp3file)) {             mp3file mp3file = (mp3file)file;              switch (tablecolumn.title) {             case "artist":                 mp3file.artist = value;                 break;             case "title":                 mp3file.title = value;                 break;             case "album":                 mp3file.album = value;                 break;             case "bpm":                 mp3file.bpm = value;                 break;             case "comment":                 mp3file.comment = value;                 break;             case "year":                 mp3file.year = value;                 break;             case "key":                 mp3file.initialkey = value;                 break;             }         }     } } 

and here datasource:

    public class mp3filedatasource  : nstableviewdatasource {      public list<audiofile> audiofiles = new list<audiofile> ();      public mp3filedatasource () {      }      public override nint getrowcount (nstableview tableview) {         return audiofiles.count;     } } 

i thankful, if me little.

thanks


Comments