public virtual ITextChunkView <PlainTextDocument> CreateChunkFor(ITextNode node, IStyle style)
        {
            var offset    = node.Document.CreatePosition(node.Offset, Bias.Forward);
            var endOffset = node.Document.CreatePosition(node.EndOffset, Bias.Backward);
            var chunkView = new TextChunkView <PlainTextDocument>(TextProcessingRules, node, style, offset, endOffset);

            chunkView.Initialize();
            return(chunkView);
        }
Example #2
0
        TextChunkView <PlainTextDocument> CreateChunk(int?start = null, int?end = null, string text = null)
        {
            var doc = new PlainTextDocument();

            doc.InsertAt(0, text ?? "Hello World, Here I am. Can you see me? This is on the next line.");
            var node = doc.Root[0];

            var startOffset = start ?? node.Offset;
            var endOffset   = end ?? node.EndOffset;

            var chunk = new TextChunkView <PlainTextDocument>(
                new TextProcessingRules(),
                node,
                textStyle,
                node.Document.CreatePosition(startOffset, Bias.Forward),
                node.Document.CreatePosition(endOffset, Bias.Backward));

            chunk.Initialize();
            return(chunk);
        }