public void BindToTextLayer(EditableTextFlowLayer textLayer) { this.textLayer = textLayer; //check is on the sameline, //or multiple lines // if (IsOnTheSameLine) { EditableTextLine line = textLayer.GetTextLine(selectionRangeSnapshot.startLineNum); //at this line //find start and end point int startColNum = selectionRangeSnapshot.startColumnNum; int endColNum = selectionRangeSnapshot.endColumnNum; int lineHeight = line.ActualLineHeight; _startLocation = new MarkerLocation() { lineNum = line.LineNumber, x_offset = line.GetXOffsetAtCharIndex(startColNum), line = line }; _stopLocation = new MarkerLocation() { lineNum = line.LineNumber, x_offset = line.GetXOffsetAtCharIndex(endColNum), line = line }; } else { EditableTextLine startLine = textLayer.GetTextLine(selectionRangeSnapshot.startLineNum); _startLocation = new MarkerLocation() { lineNum = startLine.LineNumber, x_offset = startLine.GetXOffsetAtCharIndex(selectionRangeSnapshot.startColumnNum), line = startLine }; // EditableTextLine endLine = textLayer.GetTextLine(selectionRangeSnapshot.endLineNum); _stopLocation = new MarkerLocation() { lineNum = endLine.LineNumber, x_offset = endLine.GetXOffsetAtCharIndex(selectionRangeSnapshot.endColumnNum), line = endLine }; // } }