currently, I'm using Richeditbox in my to edit and display formatted text in App. there a now a lot of RichEditBoxes. because its the goal of the App, to show a list of formatted text blocks with different Content. The Performance is really slow and the space in DB is great, I'm storing the text in RTF-format in blobs.
What is the easiest way to show simple formatted Text (eg bold, italic)? I never found a quite sample?
If you just want to display formatted text you have two options.
RichTextBlock is a TextBlock-like counterpart of RichEditBox. It is however more performant as it just displays the content and does not offer editing.
Alternatively there is a MarkdownTextBlock control in the UWP Community Toolkit, which can display simple formatted text in the Markdown format.
Related
I am creating a template where users will be able to type in text and would like to make it so they can format it. Preferably by methods similar to Word where they can select the text and then click a button, but I would be OK with allowing them to put the tags in there also, like < b > < / b>, etc as long as it formats properly.
Is there an easy way to do this using Inlines at runtime?
I definitely recommend you having a look at RichTextBox:
The RichTextBox control enables you to display or edit flow content including paragraphs, images, tables, and more. This topic introduces the TextBox class and provides examples of how to use it in both Extensible Application Markup Language (XAML) and C#. (Microsoft docs)
Here is a pretty indepth tutorial of using RichTextBox to create a text editor, using buttons allowing the user to changes properties such as font size, bold, colour, etc... :
https://wpf-tutorial.com/rich-text-controls/how-to-creating-a-rich-text-editor/.
I would like to create a Richtextbox which load a huge file (several pages of text in some format) and based on format it formats the text (let's say it display html).
I found how to change format of text using selection, but that is very slow and resource expensive. Is there a way to append a preformatted text to Rich Text Box? So that I can format each element and then append it.
This might help you if not the answer you are looking for
But RichTextBox.CanPaste Method determines whether you can paste information from the Clipboard in the specified data format. Please see link the for the System.Windows.Forms.DataFormats it will support
I have a richtextbox on my wpf form that the user types into, with no restrictions on length. However, on my active reports output, I have pages with fixed-space textboxes on each page. Is there any way to figure out how much of the rich text will fit into a textbox, write it out, and then continue writing the rest on the next page until i run out of text to write?
You can measure the length of plain text on an ActiveReports Page using the Page object's MeasureText method. See the following documentation: http://www.datadynamics.com/help/activereports6/ActiveReports.Document~DataDynamics.ActiveReports.Document.Page~MeasureText.html
If you have RTF output (I'm not sure if you do or not based on the information provided) it is probably not feasible to manually measure the text and break it up simply because RTF text is complex and breaking into parts is more difficult. However, the RichEdit/RTF control in ActiveReports should be able to paginate/page break it fine if you can let that control grow.
Is it possible to have differently colored lines in multiline text box?
I'm adding data to the text box and I want to clarify for the user different types of text by color.
How to do this if it's possible?
You can do this if you use a RichTextBox control. See the documentation here (particularly look at the Remarks and Examples sections). The standard TextBox does not offer this capability.
The standard Winforms textbox does not have this ability (and adding it would be troublesome).
You could look at using the System.Windows.Forms.RichTextBox as an alternative for this or one of the many commercial alternatives.
So depending on how you want the output, there's an browser/html control (basically a box), that you can pass a URL or a string of HTML, depending on what you're doing, you might want to use the RickTextBox - which has formatting commands - you could use regular expressions, or the offset of the text and then use a "set color" command on the text box with an IF structure.
How to display the large text in the richtextbox. I need to use with MVVM pattern.
Can anyone suggest me a wpf control to display large text or how to make the richtextbox to display entire content?
Richtextbox can display more than 1000 lines. I use the one for cat and it works just nice(with all the formatting and etc). May be you have vertical scroll OFF and you cant see the rest of the lines?! see Shoaib Shaikh answer with suggested properties values.
Rich text box can also have same properties to accept multiple lines as textbox does. in order to conditionally format some lines in red you will have to provide Flow document in RichTextbox. you can create flow document by xml. this is an article could be helpful
http://www.codeproject.com/KB/WPF/BindableWPFRichTextBox.aspx