예제 #1
0
        public static TextPointer GetPositionLastCharOnLine(this TextPointer Start)
        {
            TextPointer tp       = Start;
            TextPointer lastChar = null;

            foreach (var rv in tp.SymbolsOnLine())
            {
                tp = rv.Item1;
                var pc = rv.Item2;

                if (pc == TextPointerContext.Text)
                {
                    var lx = tp.GetTextInRun(LogicalDirection.Forward).Length;
                    lastChar = tp.GetPositionAtOffset(lx - 1);
                }
            }

            return(lastChar);
        }