RichText box has not displaying the large text in WPF with MVVM - c#

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

Related

UP simple Way to store/retrieve formatted Text

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.

Is it possible to have differently colored lines in multiline text box?

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.

looking for text control that is easy to data bind and text highlight wpf

I am looking for some control that can do following 2 :
1.highlight some of the text in different colors.
easy databind.
checked richtextbox - but it is hard to databind with it.
checked textbox but it problem to text hight light with it.
any suggestions
Use the RichTextBox - or even better the Extended RichTextBox here (it allows easy DataBinding): http://wpftoolkit.codeplex.com/wikipage?title=RichTextBox.
If you don't want to have to include another control you can create an AttachedProperty to make it possible to bind to the built in RichTextBox. Check this out here: http://michaelsync.net/2009/06/09/bindable-wpf-richtext-editor-with-xamlhtml-convertor

Selectable TextBlock or a TextBox with formatted text in WPF

I have a situation where I need to show a formatted text (normal, bold, highlighted) and should also be selectable so that user can copy the text.
I have used textblock where i can apply multiple formattings using Inline content flow elements but unfortunately it's text is not selectable.
Whereas Textbox allows to select text and copy to clipboard, it does not allow me to format text.
Is there anything I am missing or I'll have to build a custom control?
I'm not sure how much style you're wanting to apply, but I find the following site to be useful to determine the best way to use Silverlight controls:
http://samples.msdn.microsoft.com/Silverlight/SampleBrowser/index.htm#/
This specific URL has some information on how to style a Textbox:
http://samples.msdn.microsoft.com/Silverlight/SampleBrowser/index.htm#/?sref=TextBoxSnippet
You can use RichTextBox. It control is selectable and support formatted tex.

C# Correct way to design/implement this UI?

This is my first tryst with C#. The form that i have in mind consists
A textfield which will be supplied with the path of an executable.
A "Run" button which will call the executable(cosole app)
The executable console output should be displayed in the rich textbox.
Now when i click on a line in richtext box, i select and get the text in the line. This text maps to some other text info. I need to display this text info as a tooltip over the line.
More explanation:
The output of the exe is displayed in the text box as
Address1=Value
Address2=Value
Now when i click the line "Address1=Value", i map this text to find some info regarding what bits are set like
enable : 1
select : 0 ..etc
this info i need to display as tooltip over the line. Is such a thing possible? Is there better alternative to RTB/tooltip for this problem?
Thanks
Vivek
I would recommend using a ListBox for each string of data returned and then if you use a tooltip it makes alot more sense because you are hovering over a list item specifically not the whole text field.
Using the ListBox and items should make it alot easier to work with overall since it will be separating them into defined items instead of just appending lines to a text box.
Also I think you might have alot of work in store for you for trying to make the text box behave the way you want it to for it to treat each line differently dependent on the text of the line.
If you're using the textbox because later you want to be able to select all the output to copy and paste it I would have the textbox hidden by default and have a button that says like "Toggle Raw Output" that will show/hide the text field so users can get the text easily. While using the ListBox as the primary display for information.
What I understand from your question is that when you click on the line in the RTB, your code scans the text on that line, identifies the extra data associated with that line and then inserts it into the tooltip for the RTB.
Technically I believe that this is possible to do - although I am not 100% sure of the mechanics of inserting tooltip text. However as a user interface feature I would personally not do that as the tooltip text is displayed whenever the mouse pointer is anywhere over the RTB. Thus if a user clicks on line #1, (and sees the data associated from line #1) but hovers the mouse of line #3, they might think that the tooltip is associated with line #3.
You could alleviate my concerns with a strongly worded tooltip, but I feel that what you are doing is misusing the tooltip for something other than what it was intended to be used for. IMHO it may be that you are better off displaying your data with a tree control rather than with a RTB, as the tree control more naturally expresses the functionality that you desire (click on a node, expand it to see details etc).

Categories

Resources