objective c - Change highlight color of NSTableView selected row -
how change nstable selected row background color?
here answer, uitable view .
for now,what see can change selected hilight style :
mytable.selectionhighlightstyle = nstableviewselectionhighlightstyle.regular;
but here 3 options;
none = -1l, regular, sourcelist
i have tried following solution :
patientlistdelegate.selectionchanged += (o, e) => { var r = patienttableview.selectedrow; var v = patienttableview.getrowview (r, false); v.emphasized = false; };
it works , if minimize , open application again , still shows blue color
i found answer in objective-c
change selection color on view-based nstableview
here c# implementation:
inside delegate :
public override nstablerowview coregetrowview (nstableview tableview, nint row) { var rowview = tableview.makeview ("row", this); if (rowview == null) { rowview = new patienttablerow (); rowview.identifier = "row"; } return rowview nstablerowview; }
and custom row :
public class patienttablerow : nstablerowview { public override void drawselection (cgrect dirtyrect) { if (selectionhighlightstyle != nstableviewselectionhighlightstyle.none) { nscolor.fromcalibratedwhite (0.65f, 1.0f).setstroke (); nscolor.fromcalibratedwhite (0.82f, 1.0f).setfill (); var selectionpath = nsbezierpath.fromroundedrect (dirtyrect, 0, 0); selectionpath.fill (); selectionpath.stroke (); } } }
Comments
Post a Comment