Skip to content

Instantly share code, notes, and snippets.

@jgold6
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save jgold6/9383602 to your computer and use it in GitHub Desktop.

Select an option

Save jgold6/9383602 to your computer and use it in GitHub Desktop.
Set the outlineView's hightStyle to "none":
outlineView.SelectionHighlightStyle = NSTableViewSelectionHighlightStyle.None;
Then in the NSOutlineViewDelegate:
public override void WillDisplayCell(NSOutlineView outlineView, NSObject cell, NSTableColumn tableColumn, NSObject item)
{
uint rowNo = (uint)outlineView.RowForItem(item);
NSColor backgroundColor;
if (outlineView.SelectedRows.Contains(rowNo)) {
backgroundColor = NSColor.Yellow;
}
else {
backgroundColor = NSColor.White;
}
Console.WriteLine("Cell: {0}", cell);
var bCell = (NSTextFieldCell)cell;
bCell.BackgroundColor = backgroundColor;
bCell.DrawsBackground = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment