richtextbox

How to print line numbers for textbox in c#

This is going to be a long post. I would like to have suggestions if any on the procedure I am following. I want the best method to print line numbers next to each CRLF-terminated-line in a richtextbox. I am using C# with .NET. I have tried using ListView but it is inefficient when number of lines grow. I have been successful in using Gr...

RichTextBox color formatting without moving visible view

Let's say that I have a RichTextBox and its contents take up about 3 times the height compared to the visible height. There's no color formatting, I want to highlight keywords. If I use SelectionStart, SelectionLength and SelectionColor, then I have to set SelectionStart back to the caret's original position. If, for example, I'm lookin...

How to change text direction in richtextbox ?

Hi .. I have RichTextBox .. if I opened a word 2003 ( or 2007 ) document and copied any table and paste it in it, the table's direction became Left-to-Right .. it reverse : EX : this --------------- | TOP | --------------- | 1 | 2 | --------------- after copy and paste in richtextbox became this : --------------- | ...

Set a certain WORD as Selected/Highlighted in WPF RichTextBox from the ViewModel ?

Hello, I have a List of items in my ViewModel. Every Item represents a Row in a DataGrid. Every Row has a column with a RichTextBox as cell editor. I am searching data in the database. The ResultViewModel has the search word And the index of the column + row in the datagrid where the searched word is located. Now I need a method in th...

Syntax highlighting in .net richtextbox, how do I deal with newlines?

I am trying to highlight some syntax in a richtextcontrol (quoted text, XML tags, XML comments). Apart from the obvious problem created by my own stupidity (for example, a run through the text to highlight the syntax takes over a second and I certainly cannot check the syntax whenever a character was typed) I also ran into an issue cause...

[WPF] RichTextBox applies Bold when I continue writing

can I somehow stop this behaviour? ...

A WPF RichTextBox + Button in a StackPanel => what a mess ?

This code: <StackPanel Orientation="Horizontal"> <RichTextBox /> <Button Content="Dialog" /> </StackPanel> shows the button somewhere on the left side of the StackPanel ONTO the RichTextBox, WHY? edit: Oh I just saw its a width problem. The RTB has nearly no width and the button is righth...

WPF RichTextBox: Disable Dragging Text within , Allow Dragging Text outside

Hello, I have a UserControl with a RichTextBox in it. It must be disallowed to drag/drop Text within the RichTextBox so the user can not change the visible sort order of the strings in the RichTextBox. But... it must be allowed to the user to drag/drop Text outside the UserControl to the same kubd if the UserControl. Is that somehow p...

Combining list boxes into rich text boxes?

Hey all, another homework assignment here thats kind of unclear on the requirements. It is a forms program that assigns people to seats on an airplane. The part that is losing me is that its telling me to display the passenger manifest in a list box, but then its telling me to display it in a list box. Then it calls it a rich text box a...

WPF RichTextBox - get whole word at current caret position

I enabled spelling on my WPF richtextbox and I want to get the misspelled word at current caret position before the context menu with spelling suggestions is displayed. ...

Wrapping Text in a rich textbox, but not word wrapping it

Hello all, I have a Windows Form with a Rich Textbox control on the form. What I want to do is make it so that each line only accepts 32 characters of text. After 32 characters, I want the text to flow to the next line (I do NOT want to insert any carriage returns). The WordWrap property almost does this, except that it moves all the te...

Accessing a classes properties for databinding with RichTextBoxes in WPF

I'm currently trying to convert a wpf form with several textboxes on it to RichTextBoxes to allow for better editing functionality. The original textboxes were all linked to an underlying storage class using databinding to a data context upon navigation to the page. public class Storage { public String IntroFormText { get; set; } pu...

Textbox with "new line"

We tried several ways to make a textbox to accept the "enter", newline, etc.. But we are still facing the same problems. Most of the "Third party" controls allow the user to format the text as he wants. Eg, add color, font, table, etc.. However, for most stylish websites, we do not want to allow the user to format the text that way. But...

WPF RichTextbox remove Foreground information from TextRange

Hey, sorry for my bad english... The default for a RichTextBox content is to inherit the Foreground color from the richtextbox itself. Thats nice, but if i set an especific color to some part of my text, that part do not inherit the foreground anymore, obviously. Now how can I make a part of that "colored" text inherit the parent color a...

How to turn on caps lock whenever rich text box has focus

I have a form with a rich text box control. Is there a way to have caps lock turn on whenever the rich textbox control has focus? And turn it off if the rich text box loses focus? I am using C# ...

Delete Functionality in RichtextBox (Windows Forms with .NET 3.5)

Hi, I am facing a problem to implement the delete functionality. The Key_Down event is not getting raised when I pressed a delete key from Keyboard. If I implement the Key_Press OR Key_Up Event. Suppose I have selected some Text from RichTextBox and pressed the DEL, then the text get removed first and then it reaches to the Event code...

Winforms Richtextbox not properly rendered in WPF project

Hello, I have a very strange issue in my WPF project. The main window contains several wpf controls and winforms RichTextbox(don't ask me why) within WindowsFormsHost element. Richtextbox contains text. In some cases Richtextbox is not properly rendered when loading window (the right part is white like somebody uses erase tool and clears...

Branding SharePoint Search Result

Hi all, In my SharePoint site I have a list wich has a column that contains rich text in it. (i.e text with bold, color and italic style). Now when user perform search, If the search key word match with the data in rich text column it will show that record as a search result which is perfect. But the result in search result page show...

WPF RichTextBox: save/load in custom format

I need to load/save data from the WPF RichTextBox in a custom format (similar to Markdown). RichTextBox supports saving/loading in several basic formats (Rtf, Text, Xaml) using TextRange.Save method: using (FileStream fs = File.OpenWrite(file)) { TextRange text = new TextRange(rtNote.Document.ContentStart, rtNote.Document.Content...

Add accent marks with custom colors in .Net's RichTextBox

Using the Text property of a WinForms' RichTextBox, you can show a letter with an accent above it, in a way that the letter is one character, and the accent is another one. I.e., also visually it looks like one character, it actually consists of two. In Unicode terms, the letter is called a 'base character', while the accent is called 'c...