A textbox/richtextbox that has syntax highlighting? [C#] [closed]
Scintilla.NET is probably what you’re looking for
Scintilla.NET is probably what you’re looking for
I’m surprised nobody has mentioned markitup: markItUp! is a JavaScript plugin built on the jQuery library. It allows you to turn any textarea into a markup editor. Html, Textile, Wiki Syntax, Markdown, BBcode or even your own Markup system can be easily implemented.
Make sure the text property includes a valid url. E.g. http://www.stackoverflow.com/ set the DetectUrls property to true Write an event handler for the LinkClicked event. Personally, I wouldn’t pass “IExplore.exe” in as a parameter to the Process.Start call as Microsoft advise as this presupposes that it is installed, and is the user’s preferred browser. If … Read more
I did it with style (pun indented) <RichTextBox Margin=”0,51,0,0″ Name=”mainTextBox” > <RichTextBox.Resources> <Style TargetType=”{x:Type Paragraph}”> <Setter Property=”Margin” Value=”0″/> </Style> </RichTextBox.Resources> </RichTextBox>
You could try setting the SelectionStart property to the length of the text and then call the ScrollToCaret method. richTextBox.SelectionStart = richTextBox.Text.Length; richTextBox.ScrollToCaret();
There is a much easier way! You can easily create an attached DocumentXaml (or DocumentRTF) property which will allow you to bind the RichTextBox‘s document. It is used like this, where Autobiography is a string property in your data model: <TextBox Text=”{Binding FirstName}” /> <TextBox Text=”{Binding LastName}” /> <RichTextBox local:RichTextBoxHelper.DocumentXaml=”{Binding Autobiography}” /> Voila! Fully bindable … Read more
Yes, you can use the ScrollToCaret() method: // bind this method to its TextChanged event handler: // richTextBox.TextChanged += richTextBox_TextChanged; private void richTextBox_TextChanged(object sender, EventArgs e) { // set the current caret position to the end richTextBox.SelectionStart = richTextBox.Text.Length; // scroll it automatically richTextBox.ScrollToCaret(); }
SimpleMDE, a newcomer, may be the answer. I’ve been searching for something just like this for a month now. I’m surprised that this does not show up higher in search results. I had to go through a notice on lepture/editor to find this.
to set RichTextBox text: richTextBox1.Document.Blocks.Clear(); richTextBox1.Document.Blocks.Add(new Paragraph(new Run(“Text”))); to get RichTextBox text: string richText = new TextRange(richTextBox1.Document.ContentStart, richTextBox1.Document.ContentEnd).Text;
Here is an extension method that overloads the AppendText method with a color parameter: public static class RichTextBoxExtensions { public static void AppendText(this RichTextBox box, string text, Color color) { box.SelectionStart = box.TextLength; box.SelectionLength = 0; box.SelectionColor = color; box.AppendText(text); box.SelectionColor = box.ForeColor; } } And this is how you would use it: var userid … Read more