Silverlight Rich TextBox

This Silverlight only Rich TextBox is easy to implement on your Silverlight driven website and is also customizable to provide a visual feel suitable for any site design.

To use the Rich TextBox control you will need to add a reference to Liquid.RichText.dll in your project.

How to Use the Rich TextBox Control

To use the Rich TextBox on your Silverlight page:

<UserControl x:Class="RichTextBox.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:liquidRichText="clr-namespace:Liquid;assembly=Liquid.RichText"
    Width="400" Height="300">
    <Canvas x:Name="LayoutRoot" Background="White">
        <StackPanel Orientation="Horizontal" Canvas.Left="10" Canvas.Top="20">
            <Button x:Name="makeBold" Width="24" Height="23" Click="MakeBold_Click" Margin="10, 2, 2, 2" ToolTipService.ToolTip="Bold">
                <TextBlock x:Name="boldText" Text="B" FontFamily="Arial" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" />
            </Button>
            <Button x:Name="makeItalic" Width="24" Height="23" Click="MakeItalic_Click" Margin="2" ToolTipService.ToolTip="Italic">
                <TextBlock x:Name="italicText" Text="I" FontFamily="Arial" FontSize="14" FontStyle="Italic" HorizontalAlignment="Center" VerticalAlignment="Center" />
            </Button>
            <Button x:Name="makeUnderline" Width="24" Height="23" Click="MakeUnderline_Click" Margin="2" ToolTipService.ToolTip="Underline">
                <TextBlock x:Name="underlineText" Text="U" FontFamily="Arial" FontSize="14" TextDecorations="Underline" HorizontalAlignment="Center" VerticalAlignment="Center" />
            </Button>
            <ComboBox x:Name="selectFontFamily" Width="155" Height="23" Margin="10, 2, 2, 2" SelectionChanged="SelectFontFamily_ItemSelected">
                <ComboBoxItem Content="Arial" FontSize="14" FontFamily="Arial" IsSelected="True" />
                <ComboBoxItem Content="Arial Black" FontSize="14" FontFamily="Arial Black" />
                <ComboBoxItem Content="Comic Sans MS" FontSize="14" FontFamily="Comic Sans MS" />
                <ComboBoxItem Content="Courier New" FontSize="14" FontFamily="Courier New" />
                <ComboBoxItem Content="Lucida Grande" FontSize="14" FontFamily="Lucida Grande" />
                <ComboBoxItem Content="Lucida Sans Unicode" FontSize="14" FontFamily="Lucida Sans Unicode" />
                <ComboBoxItem Content="Times New Roman" FontSize="14" FontFamily="Times New Roman" />
                <ComboBoxItem Content="Trebuchet MS" FontSize="14" FontFamily="Trebuchet MS" />
                <ComboBoxItem Content="Verdana" FontSize="14" FontFamily="Verdana" />
            </ComboBox>
            <ComboBox x:Name="selectFontSize" Width="45" Height="23" Margin="2" SelectionChanged="SelectFontSize_ItemSelected">
                <ComboBoxItem Content="8" />
                <ComboBoxItem Content="9" />
                <ComboBoxItem Content="10" IsSelected="True" />
                <ComboBoxItem Content="11" />
                <ComboBoxItem Content="12" />
                <ComboBoxItem Content="14" />
                <ComboBoxItem Content="16" />
                <ComboBoxItem Content="18" />
                <ComboBoxItem Content="20" />
                <ComboBoxItem Content="22" />
                <ComboBoxItem Content="24" />
                <ComboBoxItem Content="26" />
                <ComboBoxItem Content="28" />
                <ComboBoxItem Content="36" />
                <ComboBoxItem Content="48" />
                <ComboBoxItem Content="72" />
            </ComboBox>
        </StackPanel>
        <liquidRichText:RichTextBox x:Name="richTextBox" Canvas.Left="20" Canvas.Top="50" Width="295" Height="200" />
    </Canvas>
</UserControl>
 

The Rich TextBox can be set to plain text or rich text in the custom format.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Liquid;
using Liquid.Components;
namespace RichTextBox
{
    public partial class Page : UserControl
    {
        #region Private Properties
        private SolidColorBrush _buttonFillStyleNotApplied = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
        private SolidColorBrush _buttonFillStyleApplied = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
        private bool _ignoreFormattingChanges = false;
        #endregion
        public Page()
        {
            InitializeComponent();
            richTextBox.Text = "Some plain text.";
            richTextBox.SelectionChanged += new RichTextBoxEventHandler(RichTextBox_SelectionChanged);
        }
        private void RichTextBox_SelectionChanged(object sender, RichTextBoxEventArgs e)
        {
            UpdateFormattingControls();
        }
        private void UpdateFormattingControls()
        {
            makeBold.Background = _buttonFillStyleNotApplied;
            makeItalic.Background = _buttonFillStyleNotApplied;
            makeUnderline.Background = _buttonFillStyleNotApplied;
            if (richTextBox.SelectionStyle.Weight == FontWeights.Bold)
            {
                makeBold.Background = _buttonFillStyleApplied;
            }
            if (richTextBox.SelectionStyle.Style == FontStyles.Italic)
            {
                makeItalic.Background = _buttonFillStyleApplied;
            }
            if (richTextBox.SelectionStyle.Decorations == TextDecorations.Underline)
            {
                makeUnderline.Background = _buttonFillStyleApplied;
            }
            SetSelected(selectFontFamily, richTextBox.SelectionStyle.Family);
            SetSelected(selectFontSize, richTextBox.SelectionStyle.Size.ToString());
        }
        private void SetSelected(ComboBox combo, string value)
        {
            if (value != null)
            {
                _ignoreFormattingChanges = true;
                foreach (ComboBoxItem item in combo.Items)
                {
                    if (item.Content.ToString().ToLower() == value.ToLower())
                    {
                        combo.SelectedItem = item;
                        break;
                    }
                }
                _ignoreFormattingChanges = false;
            }
        }
        private void MakeBold_Click(object sender, RoutedEventArgs e)
        {
            Formatting format = (makeBold.Background == _buttonFillStyleNotApplied ? Formatting.Bold : Formatting.RemoveBold);
            ExecuteFormatting(format, null);
        }
        private void MakeItalic_Click(object sender, RoutedEventArgs e)
        {
            Formatting format = (makeItalic.Background == _buttonFillStyleNotApplied ? Formatting.Italic : Formatting.RemoveItalic);
            ExecuteFormatting(format, null);
        }
        private void MakeUnderline_Click(object sender, RoutedEventArgs e)
        {
            Formatting format = (makeUnderline.Background == _buttonFillStyleNotApplied ? Formatting.Underline : Formatting.RemoveUnderline);
            ExecuteFormatting(format, null);
        }
        private void SelectFontFamily_ItemSelected(object sender, EventArgs e)
        {
            if (selectFontFamily != null)
            {
                ExecuteFormatting(Formatting.FontFamily, ((ComboBoxItem)selectFontFamily.SelectedItem).Content.ToString());
            }
        }
        private void SelectFontSize_ItemSelected(object sender, EventArgs e)
        {
            if (selectFontSize != null)
            {
                ExecuteFormatting(Formatting.FontSize, double.Parse(((ComboBoxItem)selectFontSize.SelectedItem).Content.ToString()));
            }
        }
        private void ExecuteFormatting(Formatting format, object param)
        {
            if (!_ignoreFormattingChanges)
            {
                richTextBox.ApplyFormatting(format, param);
                richTextBox.ReturnFocus();
            }
        }
    }
}
 

Example Silverlight Rich TextBox Control:

Silverlight Rich TextBox Control

Your Comments and Questions Answered

 You are not logged in. You need to login to post new messages, if you do not have a login you can register for free!

luke said:

Is there any way to make a RichTextBox readonly and also selectable?

06/29/2009 06:56
 
mrLIS said:

06/29/2009 07:15
 
Cipherlad said:

Okay, I'm starting to get the pattern matching and styling to work the way I want it to, and thought I'd post back on here since the "how to" on this seems to be largely undocumented.

By catching the pattern match in the TextPatternMatch event, we have available RichTextBoxEventArgs in the event parameters. This parameter has a Parameter field that holds an Object, but comes into the event as System.String, containing the value of the string that was matched.

Now what is needed is to replace the event RichTextBoxEventArgs.Parameter with a TextBlockPlus object. The TextBlockPlus.Text property should be set to the string value you want to have appear in the box. Note, this is a plain text assignment. All other formatting done to the TextBlockPlus has no effect on the styling of the string in the RichTextBox.

To get the styling applied to the string at this point is a little strange. Now, one would apply the formatting styles using the ApplyFormatting method, followed by the ReturnFocus method. Although ApplyFormatting is supposed to work on selected text, in this context it gets applied to the TextBlockPlus object assigned to the RichTextBoxEventArgs.Parameter property. My guess is that somewhere in the post-processing of the TextPatternMatch event, the text is actually picked up as a selection by the internal process of the RichTextBox, styled, and then returned to the original cursor location when the event completes.

Once caveat here is that no styling will occur unless the plain text value itself is somehow different than the original. I don't know why this should be the case, and am investigating further.

06/24/2009 11:42
 
Cipherlad said:

I'm trying to see if I can use the pattern matching feature of the rtb to have styles auto-applied to certain words or phrases when they are typed in by the user. I'm finding this really difficult to acheive because it looks like the only way to do it is to program selections/deselections of text, and I don't want to have to move the cursor focus at all. Am I missing something??

06/23/2009 10:00
 
gigyjoseph said:

Is there any way I can have more than one of this kind controls on a canvas with only ONE set of tool bar and set the properties individually especially AlignLeft, AlignCenter, AlignRight, Indent etc

Thanks
Gigy

06/22/2009 12:45
 
anonymous said:

I don't know how to use it. Please help. I would like to drop the control on my form and have all the functionality seen above is this any possible or I have to do extra work to get the nice toolbar with all the tools for the rich textbox ?

I downloaded the dlls, I did drop a RichTextBox on my form and all I have is a white box which does nothing. I even tried to add text by code in .Text and I dont see it. I did try to write something in that box and nothing is visible. I see the cursor moving but nothing is written.

I cerntainly don't know how to use it.
but it seems so nice and good.

06/20/2009 02:45
 
dan said:

Hi smahabalagiri,

Yes this is a known bug which will be fixed in the next version. Thanks!

06/19/2009 11:04
 
dan said:

Hi Lawrence,

Sure, these 2 bugs are currently on the fix list and will be fixed in the next version which will be ready in early July hopefully. Thanks!

06/19/2009 11:03
 
dan said:

Hi kkk,

Regarding your first problem, this is a know issue and is being fixed at this moment. Your 2nd questions about <p> tags will be investigated/corrected as appropriate. Thanks!

06/19/2009 11:01
 
dan said:

Hi bridgette,

Not at the moment. It is a multi-line textbox only for now. Thanks!

06/19/2009 11:00
 
dan said:

Hi dpa,

Thats right you will, I've answered this below but will summarize here. The RichTextBox can only copy/paste to/from the system clipboard using plain text, this is a limitation of Silverlight and maybe Microsoft will enhance clipboard support in SL3... Maybe... Thanks!

06/19/2009 10:59
 
dan said:

Hi Sergey,

I haven't been able to test the HTML output with SSRS, I assume the richtextbox is including the styles, either inline or as a block of CSS? Quite simply we test that it works in the major browsers. Thanks!

06/19/2009 10:56
 
dan said:

Hi instruo,

You are absolutely right, and this change will be implemented in the next version. Thanks!

06/19/2009 10:54
 
dan said:

Hi WolveFred,

I think what you need is to set the RichTextBox.HorizontalScrollBarVisibility property to Visible. It is a known issue at the moment that large images can be hard to handle in a richtextbox instance and we're looking to add something to help with this. Thank!

06/19/2009 10:51
 
dan said:

Hi kramer1982,

The copy/paste functionality is limited to plain text. This is quite simply because Silverlight does not allow access to the clipboard, the copy/pasting here is achieved using a standard TextBox.

06/19/2009 10:49
 
smahabalagiri said:

Hi,
I'm not able to export to HTML if we insert the image, I tried with replacing image with html &lt;img&gt; tag in event ElementWrite method, Even ElementWrite event does not firing(not working) for html save, is it bug ? or any other workaround is there??

I have used as below to export to html
Ex. conversion = richTextBox.Save(Format.HTML, RichTextSaveOptions.None);

06/17/2009 02:03
 
Lawrence Suen said:

Hi,

I had reported this bug a couple of months ago and it doesn't seem to be fixed: the "delete" key does not work in the last line (try it in the demo).

There is another bug that I need fixed: it is almost impossible to select xaml objects with the mouse (try selecting the checkbox in the demo. you end up selecting the rest of the sentence).

Thanks and Cheers,
Lawrence

06/01/2009 02:22
 
kkk said:

Hi

I just test your Rich TextBox
I find something bugs

1. HTML property has error when i set html tag that created by Rich TextBox
     but i get rid style tag and set HTML property it work
     but bold style is blown away because default style has not bold sytle
2. when i get HTML property contain <li> tag created by numbering option or bullet option
    Rich TextBox add wrong tag <p> automatically

Is there plan to fix that bug?
    Regards

05/27/2009 06:36
 
bridgette said:

Firstly - REALLY amazing control. Thank you!

Now I have a question. Is there anyway to make the RTB function properly if it is a single-line textbox? I want the textbox to work without scrollbars, and to scroll the text left and right on a single line, but it always seems to wrap the text even if I set the wrap-properties to disabled?

Regards,

Bridgette

05/27/2009 04:37
 
dpa said:

Hi
I wish to copy my outlook signature in RichTextBox.

I copy my signature from outlook (<ctrl><C>),
when I paste (<ctrl><V>) my signature in word, I have the same presentation.
when I paste (<ctrl><V>) the signature in the richtextbox, I lose the attributes of presentation.

How can it be done?

Regards.
D.

05/26/2009 08:18
 
Sergey.Barskiy said:

Thanks for great control.
I have a question regarding HTML property. I am trying to render that output inside SSRS 2008 using new option for HTML, but the styles seems to be ignored. Is there any way around this issues?

Thanks.
Sergey

05/26/2009 06:32
 
Sergey.Barskiy said:

Thanks for great control.
I have a question regarding HTML property. I am trying to render that output inside SSRS 2008 using new option for HTML, but the styles seems to be ignored. Is there any way around this issues?

Thanks.
Sergey

05/26/2009 06:19
 
Sergey.Barskiy said:

Thanks for great control.
I have a question regarding HTML property. I am trying to render that output inside SSRS 2008 using new option for HTML, but the styles seems to be ignored. Is there any way around this issues?

Thanks.
Sergey

05/26/2009 06:14
 
instruo said:

One minor request, would it be possible to use (or, at least have the option to use) nbsp; instead of the space character in the .HTML output in content areas? Would help to keep the HTML output looking consistent with what's in the textbox when viewed in a browser.

Thanks! You guys do great work!

05/22/2009 10:02
 
Fiesta1_1 said:

Hello Dan,
I work on a text in HTML, I add it to RichTextBlock through property rich.HTML. As a result I get the text as XML and I convert
it into HTML using slightly modified ConvertRichTextToHTML function. The (original) text contains special tags
__FN=1__, __FN=2__ etc. Tags are created using XMAL Image. I insert a particular image in richtext. Then I convert
XAML object to the tag (e.g.__FN=3__) using the function of conversion to HTML. I would like to ask what method I should
use for reverse conversion, i.e. to get image instead of __FN=2__.
When I find all occurences of __FN=in the text and try to convert them into <xaml>….</xaml>
I get <text><!CDATA[<xmal>….]/></text> which is incorrect.
What is the easiest method of converting a text into XAML image.

Best
Przemek

05/21/2009 03:11
 
WolveFred said:

Hi dan,

I added the support to add external image and that's working : this image is displaying in the rich text box. The problem is that when the image is very big, I would like that the horizontal scroll bar opens. But that's not the case. I didn't find where to set the horizontal scroll bar. Would you have an idea ?

05/15/2009 08:25
 
kramer1982 said:

Hi,

Had one question related to the RichTextBox: Is there a way for detecting a paste operation on the control? For example, I would need to be able to copy-paste excel content in the box, and insert tables (e.g. how Word does) in order to keep the excel feel. Is this possible?
And one other question/suggestion: it would be really cool if all of these controls were scrollable by default, whenever I try to scroll over a SL control in a IE window with scrollbars, the whole window scrolls, instead of the SL control.

Thanks,
Mihnea

P.S. nice job on these controls, keep up the good work :)

05/15/2009 06:38
 
dan said:

Hi datadata,

The ability to set the bullet style as an image is being implemented in the next version which should be what you need. Thanks!

05/14/2009 07:27
 
dan said:

Hi Wituss,

This may be related to the existing import/export bug for the HTML property which I will look into further. However on a more general not when setting the HTML property your HTML must be XHTML compliant, i.e. this string is fed into an XML reader so the tags must be properly formed. Thanks!

05/14/2009 07:26
 
dan said:

Hi spacegodzilla,

Yes, this is a know bug which is currently being fixed for the next version. Thanks!

05/14/2009 07:24
 
dan said:

Your next post Greg:

To add an Image to the RichTextBox you can use the Insert() method, this takes a string of RichText so can take anything not just Images. Hope this helps you out!

05/14/2009 07:23
 
dan said:

Hi Gregory Titus,

This is strange, I tried this in C# using:

if (richTextBox.SelectionStyle.Decorations == TextDecorations.Underline)
{
            // Do something
}

The above works fine, I checked it in VB.NET and there is indeed the problem you've described. I will look into this further to see if there is a workaround but I don't think there will be as I tried to do the same for a regular TextBlock and the same problem occurs here so I think it maybe to do with the VB.NET compiler.

05/14/2009 07:20
 
dan said:

Hi dje33510,

Yes, this is a known bug which is being fixed and should be available in the next version soon. Thanks!

05/14/2009 07:07
 
dan said:

Hi Tianliang Guo,

Which event of the RichTextBox are you using? The correct event to use is LinkClicked, this is fired in the RichTextBox when you CTRL-Click the link or if you're using the Rich TextBlock it will be fired with just a click in read-only mode. Thanks!

05/14/2009 07:06
 
dan said:

Hi tarajaka,

You would be better using a field type of NTEXT in SQL Server as this doesn't have any size limits. Hope this helps!

05/14/2009 07:02
 
dan said:

Hi dje33510,

There shouldn't be a problem using this in VB, have you tried to cast it to SolidColorBrush instead?

05/14/2009 07:01
 
dan said:

Hi episcopus,

There is a bug in the data binding which is being looked into at the moment. Thanks!

05/14/2009 06:57
 
datadata said:

Hi,

first of all congrats for your nice controls. Your RichtText control fits our needs mostly. What we are missing is the possibility to change the bulletstyle to custom images. Is this possible with the current version? If not then is it psossible to buy the sources for that control so that we can implement it on our own?

Kind Regards

05/08/2009 02:07
 
Wituss said:

"Nullable object must have a value" exception.

         private void btn1_Click(object sender, RoutedEventArgs e) //I click this first
         {
                RichText.HTML = "<b>asdfasdf</b>sdfasd";
         }

         private void btn2_Click(object sender, RoutedEventArgs e) // Then I click this
         {
                txt1.Text = RichText.HTML; //Here is this exception
         }

Where is problem?

05/05/2009 11:40
 
spacegodzilla said:

Actually the error below happens when I have absolutely no content as well.

05/05/2009 08:48
 
spacegodzilla said:

When I try to retrieve the HTML with the latest version I get the following exception:

An item with the same key has already been added.; System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
.System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
.System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
.Liquid.RichTextBoxStyle.ToHTML()
.Liquid.RichTextBlock.GetStylesAsText(Format format, RichTextSaveOptions options)
.Liquid.RichTextBlock.SaveSelectionToText(RichTextBoxPosition start, RichTextBoxPosition end, Format format, RichTextSaveOptions options)
.Liquid.RichTextBlock.SaveSelectionToText(Int32 startGlobalIndex, Int32 globalLength, Format format, RichTextSaveOptions options)
.Liquid.RichTextBlock.Save(Format format, RichTextSaveOptions options)
.Liquid.RichTextBlock.get_HTML()

It is very simply content - just two lines. Any ideas? I spent a lot of time integrating this into my app and this is the last step, but it's all for naught if this method does not work!

05/05/2009 08:43
 
Gregory Titus said:

Another question for you dan, is do you have an example of adding an image inline programmaticvally to your Rich Text box?

-Greg

05/03/2009 11:54
 
Gregory Titus said:

sorry for the repost.


:)

05/03/2009 11:35
 
Gregory Titus said:

you seem to have an issue with the property rtxtChat.SelectionStyle.Decorations, and the ability to compare it to equating to TextDecorations.Underline.

The following line:
         If rtxtChat.SelectionStyle.Decorations = TextDecorations.Underline Then

Gives the following error:
Operator '=' is not defined for types 'System.Windows.TextDecorationCollection' and 'System.Windows.TextDecorationCollection'.


Thanks in advacne,

05/03/2009 11:34
 
Gregory Titus said:

you seem to have an issue with the property rtxtChat.SelectionStyle.Decorations, and the ability to compare it to equating to TextDecorations.Underline.

The following line:
         If rtxtChat.SelectionStyle.Decorations = TextDecorations.Underline Then

Gives the following error:
Operator '=' is not defined for types 'System.Windows.TextDecorationCollection' and 'System.Windows.TextDecorationCollection'.


Thanks in advacne,

05/03/2009 11:28
 
dje33510 said:

Hi,

I have a problem with importing and exporting images include in the rich text box, richtext.HTML not work with images.
I have 5.2.0 Rich Text Box.

I develop an emailing feature, then HTML is very important for me.


Thanks in advance.

04/30/2009 07:55
 
Tianliang Guo said:

Hi Dan:

The Hyperlink is not work in RichTextBox,
The richTextBox_LinkClicked event is not trigger in the RichTextBoxDemo.

How can I use the Hyperlink in RichTextBox.

I would greatly appreciate your assistance in this matter. Thank you.

04/29/2009 07:00
 
dje33510 said:

Hi,

Thanks for this great control.

I have a problem to passed this control in a Silverlight Application VB.NET. Bold and some others features does not run very good.

My code :
Private Sub MakeBold_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
         Dim format As Formatting = (If(makeBold.Background = _buttonFillStyleNotApplied, Formatting.Bold, Formatting.RemoveBold))
         ExecuteFormatting(format, Nothing)
     End Sub

makeBold.Background = _buttonFillStyleNotApplied is not possible i have this message Media.Brush is different of SolidMediaBrush.

I try to cast MakeBold.Background in SolidMediaBrush but i have the same error message.

Thanks in advance.

04/27/2009 06:04
 
tarajaka said:

Dear Mr Dan,

That's great. Thanks so much for your sharing.
I used your richtextbox control. But there is problems here.

With your example content (example content in RichTextBox), Length of content is so big and I cannot use in WCF, I cannot store that content in database (Content: 17k, Max store: NVARCHAR(4000)). I exported the content to xml and it's so big (same data that stored in database). I tried to use HTML but it's impossible

How can I store that content to database?

Thanks in advance.

04/26/2009 03:11
 
episcopus said:

Hi Dan:

I know you're probably a very busy person, so I'll keep this brief.

I am using your RichTextBox control inside my own custom control, inside my application. I am databinding to the RichTextBox's HTML property via Dependency Properties in the controls and INotifyPropertyChanged-enabled properties in my data objects. The initial databind works and all is well. However, when I modify the text, the associated memory object's property is not being updated. Thus, when I "refresh" the control, nothing has changed.

These same steps work perfectly for a regular TextBox's Text property. Is there any special logic required to use two-way databinding with the RichTextBox HTML property?

I would greatly appreciate your assistance in this matter. Thank you.

04/22/2009 05:05
 
episcopus said:

Hi Dan:

I know you're probably a very busy person, so I'll keep this brief.

I am using your RichTextBox control inside my own custom control, inside my application. I am databinding to the RichTextBox's HTML property via Dependency Properties in the controls and INotifyPropertyChanged-enabled properties in my data objects. The initial databind works and all is well. However, when I modify the text, the associated memory object's property is not being updated. Thus, when I "refresh" the control, nothing has changed.

These same steps work perfectly for a regular TextBox's Text property. Is there any special logic required to use two-way databinding with the RichTextBox HTML property?

I would greatly appreciate your assistance in this matter. Thank you.

04/22/2009 04:56
 
dan said:

Hi RichardReeder,

Thanks for raising this. The XAML output needs more work doing on it which I will hopefully get around to doing soon and your suggestion is noted and hopefully I can get this implemented. Thanks!

04/20/2009 11:58
 
dan said:

Hi Anatoly_Unknown,

There is no way to set a minimum height at the moment but I will look into this too see if it is possible and let you know if I can get this into a future version. Thanks!

04/20/2009 11:56
 
dan said:

Hi rsmith,

You do not need the source code to do this. By applying a custom style to your richtextbox you can customize the scrollbars any way you like. There are lots of articles out there on styling controls. The default richtextbox style can be found here. Thanks!

04/20/2009 11:54
 
dan said:

Hi selstam,

Yes. Thank you for raising this, it is a known bug which will be fixed in the next version. Thanks!

04/20/2009 11:51
 
dan said:

Hi kdsnakeware,

Firstly your 2 questions:

1. Quite simply time. I added this as a "quick" solution to get richtext into a format suitable for use with the WPF richtextbox. More work needs to be done on it.

2. Yes I agree storing bullets like this can make it difficult and changing it now will cause compatibility issues. It is something that needs to be looked at by myself.

As for your request regarding Tooltips, there is an event on the RichTextBox named "ElementWrite" which is fired when an element is being serialized to XAML. In here you are able to write the tooltip property yourself. Thanks!

04/20/2009 11:50
 
RichardReeder said:

Hi Dan,
I am using the liquid rich text box in silverlight, with some none standard scripty fonts, only basic options like size, color, bold, center etc. Then trying to replicate the rich text in a WPF rich text box, using the XAML output.

I had a few issues getting the line wrapping to happen in the same place in all fonts, I thought there was a </Run> placed at each line wrap. So my logic was to add a paragraph after a Run close when the Run definition was the same as before and there was not already a paragraph.

Works perfectly until I managed to make some lines of text that randomly have Run end and start that are not line wrapping.

Any suggestions how to do this, would it be possible to have an option to insert a paragraph on a line wrap in the XAML?

Thanks
Richard

04/15/2009 08:11
 
Anatoly_Unknown said:

Hello, Dan.
I set height of "liquidRichText:RichTextBox" to auto. After text writing I save text from this control and his height. Is there possibility to set "liquidRichText:RichTextBox" height to some min value and after this to auto from code?

04/12/2009 03:46
 
kdsnakeware said:

Feature req: The XML export has no attribute for the ToolTip you set on Xaml objects.

F.e. I want to use the ToolTip of my Image to generate a HTML alt text.

04/10/2009 02:40
 
rsmith said:

I need to customize the scrollbars look and feel. How to I get access to the source or where would I purchase the source code on this site?

04/08/2009 03:15
 
kdsnakeware said:

Ok, Thanks.

This might point Dan in the right direction. We're not waiting for this be fixed tough, because we're doing the HTML generation ourself (client deadline).

04/08/2009 06:07
 
selstam said:

Regarding

string html = richTextBox.HTML

... generating a System.InvalidOperationException.

it has to do with the images. As soon as you remove the smiley icon and the green "ball" further down the bottom the export works okay.

Cheers,
Andreas

04/07/2009 04:48
 
kdsnakeware said:

2 Questions:
1.Why doesn't the XAML output contain the XAML objects (incl tables, images)? Ironically it only contains the text.

2. Why are liquid:Bullets not nested in the XML output? This makes the to-HTML conversion so much harder. And what is your policy on changing the internal(?) XML format / output (breaking changes)?

04/06/2009 01:27
 
dan said:

Hi cclassic,

No, you're not missing anything, the RichTextBox cannot handle RTF at the moment. Most of my time is spent fixing bugs and implementing essential new features.

As ever I will add it to the wish list for future versions but implementing this sort of think is fairly complex, and doing HTML import/export is in my opinion the most important format to support out of the box, perhaps somebody could create a class to do RTF conversion?

04/05/2009 03:38
 
cclassic said:

Hi Dan,

Maybe I'm missing something, but how do I load/save RTF type files? i.e. those created in wordpad. The only format types avaliable in the load/save methods are HTML, Text, XAML, and XML.

Thanks

04/05/2009 05:04
 
dan said:

Hi Lawrence,

Thanks for reporting these, I'll look into them and hopefully get them resolved in the next version. Thanks!

04/04/2009 01:23
 
Lawrence Suen said:

Hi Dan,

2 bugs:

1) You cannot select any kind of xaml element if it is the first element in the RTB.
- Go to the RTB demo on this website and delete all the content
- Insert Number bullets (which are xaml elements). Eg:
1. I cannot select this bullet
2. I can select this bullet
3. I can select this bullet
- Now try and select all the text by clicking and dragging the mouse. You will find that it is impossible to to select "1. " but you can select all the other bullets.
I want to be able to select "1. ".

2) The IndentWidth for the bullets is not adjusted when bullets are resized
- In the RTB demo insert numbered bullets left-aligned.
- Increase the font size to 72. The bullets leak out out of the left margin and get cropped.
- Ideally the width of the bullet should be used to measure the IndentWidth (rather than _indent*40 which is the current formula).

Could you kindly look into these?

Thanks,
Lawrence

04/02/2009 11:34
 
dan said:

Hi amillion,

Thanks for your comments! When inheriting you must provide a XAML template, a sample of which can be found on the visual customizations page. Alternatively you can set in the constructor the DefaultStyleKey as the existing RichTextBox style, i.e. typeof(RichTextBox). Let me know if you have anymore problems with this!

03/30/2009 09:51
 
dan said:

Hi kdsnakeware,

Thanks for your posts and the HTML, this should help me track down the specific problem. I am still testing the controls with IE8, there shouldn't be any problems but as I've said its on the list to do. I'll investigate these problems soon and let you know.    Thanks!

03/30/2009 09:44
 
amillion said:

Hi Dan,

First, thanks for a really good silverlight rich editor with some features I haven't seen elsewhere.

I am having a problem creating a control that inherits from it. Even if I just have an empty class inheriting from Liquid.RichTextBox it compiles and runs fine but my control will not display. When I debug it seems to have no template. Any idea how to fix this?

03/28/2009 04:49
 
kdsnakeware said:

Here's my HTML for reproduction purposes:

<style type="text/css">
p {margin:0px 0px 0px 2px;}
ul {margin-top:2px;margin-bottom:2px;}
ol {margin-top:2px;margin-bottom:2px;}
H1 {font-family:Arial;font-size:28px;text-align:Left;vertical-align:Middle;color:#000000;font-weight:bold;}
H2 {font-family:Arial;font-size:24px;text-align:Left;vertical-align:Middle;color:#000000;font-weight:bold;}
H3 {font-family:Arial;font-size:18px;text-align:Left;vertical-align:Middle;color:#000000;font-weight:bold;}
.Normal {font-family:Arial;font-size:14px;text-align:Left;vertical-align:Middle;color:#000000;}
.TableDefault {border-collapse:collapse;border:1px solid #000000;}
.TableDefault th {padding:2px;vertical-align:top;text-align:left;border:1px solid #000000;}
.TableDefault td {padding:2px;vertical-align:top;text-align:left;border:1px solid #000000;}
</style>
<p><span class="Normal">test</span><img src="/misc/showFile.aspx?File=cHJpdmF0ZVwzXDFcN1w1XERTQzAwMTcxLkpQRw" /></p>

03/26/2009 01:07
 
kdsnakeware said:

Upgraded to v5.2.0

1. Now when I read back my article IE(8) stops working (dialog)! Also had this problem with Opera earlier.

2. When I make a new article and save I get:
Unhandled Error in Silverlight 2 Application Object reference not set to an instance of an object.
    at Liquid.RichTextBlock.GetElementAsText(UIElement element, Int32 elementIndex, Int32 startIndex, Int32 length, Format format, RichTextBoxStyle& currentStyle, RichTextSaveOptions options)
    at Liquid.RichTextBlock.SaveSelectionToText(RichTextBoxPosition start, RichTextBoxPosition end, Format format, RichTextSaveOptions options)
    at Liquid.RichTextBlock.SaveSelectionToText(Int32 startGlobalIndex, Int32 globalLength, Format format, RichTextSaveOptions options)
    at Liquid.RichTextBlock.Save(Format format, RichTextSaveOptions options)
    at Liquid.RichTextBlock.get_HTML()
    at RichTextBox.Page.SaveHTML()
    at RichTextBox.Page.PostUploadProcessing(String imageTag)
    at RichTextBox.Page.<>c__DisplayClassc.<UploadCompleteCallback>b__b()

This works in v5.1.7.

03/25/2009 07:23
 
kdsnakeware said:

Hi dan,

Thanks for all the fixes an new features in v5.2.0!

I now also have the same problem as dino a while back (which got no response):
string html = richTextBox.HTML; gives a
System.InvalidOperationException: Nullable object must have a value.
when reading back the HTML i assigned it earlier.

I'm using v5.1.7. I will try this with v5.2.0 this afternoon.
The HTML is simple and contains just 1 word and an image with an absolute url.

03/25/2009 06:46
 
dan said:

Thanks for your post xkrja, I'll take a look at this and get back to you. Thanks!

03/21/2009 09:34
 
dan said:

Hi Paul,

The RichTextBox inherits from the standard TextBox control and there are certain restrictions with what we can do and one of these is to not use the Text property for plain text. There are two methods Load/Save for setting/retrieving plain text. Thanks!

03/21/2009 09:33
 
Paul Fretter said:

Hi there, I am having an issue with the RichText box where I give it plain text via the .Text property, but when I come to retrieve it later (in a mouse left up event for example) the text property is empty. Visually the control still has the text, and there appears to be an RTF representation of the text in the RichText property, but no plain text.

I have upgraded to the latest build and can now use Save method to get at it, but I assume the text property should work?

The only slightly out of the ordinary thing I am doing is hosting the RTB control in a user control which it self is in an object which is in turn in a list of objects. The user control visually resides on a tab controls tab item.

Any thoughts appreciated.

Thanks
P

03/19/2009 10:31
 
xkrja said:

Hi,

I can't get the text not to wrap. I read in a previous post that you could set AutoWrap="False" and WrapWidth="10000". I tried that and I also set the TextWrapping="NoWrap" but it still wraps the text when it reaches the width of the text box. Do you know why that is?

Thanks for help!

03/19/2009 05:12
 
dan said:

Hi Richard,

There isn't an event for this at the moment, mainly because the RichTextBox is a RichTextBlock contained within a ScrollViewer and the ScrollViewer doesn't contain such an event. However, looking at the code it may be possible to insert an event when the scrollbars change visibility status, I can't say for sure if its possible but if it can I'll get it into the next version for you. Thanks!

03/16/2009 07:21
 
RichardReeder said:

Hi Dan,
Can you point me in the right direction, I need to identify when the text in a rich text box content extends outside the visible box. I have to have the scroll bars not visible but I need to effectivly know when the scroll bars would have been made visible, I dont suppose there is an event or a flag that would tell me this?

Keep up the good work.

Richard

03/16/2009 02:57
 
dan said:

Hi gosavi_as,

You are right, the RichTextBox does not support drag and drop at the moment, however as with all good suggestions it can be implemented in the next version. Thanks!

03/14/2009 05:30
 
dan said:

Hi Chris,

There are certain limitations in the current version of the control which means content is not loaded until the control is rendered and calls to Load() will fail if the control is not rendered. However you can try assigning content directly to the RichText property as this should work with what you're trying to do. Thanks!

03/14/2009 05:21
 
gosavi_as said:

We are developing a project in silverlight in which we are planing to incorporate drag and drop functionality like windows applications has. But as of now RichTextBox does not have support for drag and drop we are unable to implement that feature. Can you help me regarding this. Thanking you in advance.

03/14/2009 11:05
 
cdove79 said:

Hey,
Has anyone tried to extend these in your own class, i have tried, but it is not drawing them to the screen:

public class Test : RichTextBox
{
public Test() : base()
{
     this.Load(Format.Text, "Test");
}
}

public partial class Page : UserControl {
public Page()
{
    InitializeComponent();
    Test _t = new Test();
    LayoutRoot.Children.Add(_t);
}
}

Even something as simple as this, will not display the RichTextBox on the screen, when you add it.

Thnks Chris

03/14/2009 10:27
 
dan said:

Hi Laurence,

1. Thanks for identifying this bug, it will be fixed in the next version.
2. The default vertical alignment for an element is Center, to align at the bottom you can use VerticalAlignment="Bottom" in your XML styles which should solve this one.

Thanks!


03/14/2009 10:03
 
dan said:

Hi dolmaron,

Hopefully the next version, due to the internal workings of the RichTextBox this will be achieved using a custom event that is raised for keys that get consumed. Thanks!

03/14/2009 09:47
 
dan said:

Hi nilur,

Glad you like the control! This does seem to be a bug and one which we'll hopefully get addressed in the next version, thanks again!

03/14/2009 09:42
 
dan said:

Hi kdsnakeware,

Thanks for all your posts and keeping me busy :) Firstly you have identified some bugs which I will confirm as:

Right-clicking a table does not display the context menu, we will get this fixed.
The position of the context menu is incorrect when zoom is anything other than 1.0, this will be looked into.

The whole issue of right-clicking and getting the correct position without first having to position the cursor will be looked at to see how this can be improved, hopefully soon. Thanks!

03/14/2009 09:40
 
Lawrence Suen said:

Hi there are 2 bugs that I would like to report

1) "Delete" key does not delete when cursor is positioned in the last line.
- In the demo on http://vectorlight.net/silverlight_rich_textbox_demo.aspx click on the very last line and try the "Delete" key (without selecting text).
- If you search your code for the line "if (ElementChildren.ContentChildren[i + 1] is Newline && LineNumber == NumberOfLines)", you will find where this problem happens

2) Aligning different fonts on the same line.
- Type words with different fonts on the same line eg: <Arial text><Comic Sans text><any other font text>
- The fonts are displayed at different levels. You might need to devise an algorithm to find out how tall each font is and therefore how to vertically position it in the grid so that the bottom of the words are on the same X axis

Cheers,
Lawrence

03/12/2009 05:15
 
kdsnakeware said:

Bug: Context Menu works incorrectly when Zoom is active. Probed position should be scaled too? Not very important though.

03/11/2009 06:52
 
kdsnakeware said:

Followup on my ActiveImage-prop post:
It's even more simple if i copy e.Source to a local variable in ShowContextMenu! Now the user does not need to place the textcursor first. Why does this not work for Tables?

Followup on my Contextmenu-hover-detection-off-the-mark post:
With 5.1.8 i only get the contextmenu if i rightclick the LEFT HALF of the Image (OK in 5.1.7).
e.Source in ShowContextMenu() then is a Liquid.TextBlockPlus instead of the Image.

03/11/2009 03:18
 
kdsnakeware said:

Followup to my local-image-leftclick-exception post:
It happens when I set the Tag-property of the Image. So you must be using this as an internal reference. I don't really need to set it so this works for me, but I think this usage of Tags should be documented.

03/11/2009 02:13
 
kdsnakeware said:

Nevermind, I created ActiveImage myself based on the textcursor position.

You have to place the textcursor on the Image first, but I found out this is also needed for tables (to get the context menu). ActiveTable (used in ShowContextMenu) actually means: "Give me the Table object at the textcursor position, if any".

If there is a way to get the contextmenu working without first placing the textcursor that would be a small improvement.

Sorry for spamming the forum :-)

03/10/2009 04:14
 
kdsnakeware said:

I didn't thank you yet for this great control; Thanks!

For working with my local images (see my previous posts) I added a contextmenu item for image props. I run into the problem how to find the image I rightclicked in the list of element. I might do this by using the text-cursor coordinates, but then you'd have to place it first before you can use the context menu option...

I see you solved the same problem for tables by adding the ActiveTable prop. So an ActiveImage, or a more generic ActiveObject prop would be appreciated. Or if there is another way to solve my problem please tell.

Thanks!

03/10/2009 01:02
 
dolmaron said:

"Some key presses are consumed by the richtextbox but not passed out of the control such as return, this is something we will look to implement in the next version. Thanks!"

Which version should we expect the ability to grab the Enter key pressed event. Specifically I want Shift + Enter to insert a new line, and just pressing Enter by itself to trigger a submit method. (currently running version 5.1.8)

03/09/2009 01:36
 
nilur said:

Hi Dan!

This control is amazing, you made something I was looking for for months. But there is one thing, which is annoying me: when I insert a table, and I decrease the last coloumn's width by dragging it's right side, I cannot increase it anymore, just decrease again. I can do it with the standalone liquid table control, but can't do it with the table control inside RichTextBox, and can't do it in the online demo as well.

Is it a bug, or am I doing something wrong?

Thanks,
Nilur

03/09/2009 08:17
 
kdsnakeware said:

Followup to my contextmenu post:
I also added a contextmenu item for image props. With 5.1.8 the 'hover' detection is off the mark (compared to 5.1.7).

F.e. if I leftclick a predefined image and then rightclick my "Image props" menu item is not shown.

(I did extend richTextBox_ShowContextMenu correctly).

For the time being I reverted to 5.1.7 (got to get this to work nicely for client demo).

03/09/2009 05:59
 
kdsnakeware said:

I've added the ability to insert local images to the editor sample, but when I leftclick the image i get a KeyNotFoundException in the Liquid.RichText lib:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Liquid.RichTextBlock.ProcessUpdateSelectionStyle()

Do I need to add some (selectionstyle?) attribute? How can I remedy this?

03/09/2009 05:37
 
kdsnakeware said:

I upgraded from v5.1.7 to v5.1.8, but now the Context Menu on Tables doesn't work anymore.

03/09/2009 04:32
 
dan said:

Hi lepipele,

Some key presses are consumed by the richtextbox but not passed out of the control such as return, this is something we will look to implement in the next version. Thanks!

Hi bwhalversen,

These is no XSD documentation at the moment, we do plan to get this done soon, however in the meantime it should be fairly straight forward using the example XML in online demo. Basically to insert a FrameworkElement:

<Xaml>
<CheckBox Cursor="Arrow" />
</Xaml>

This will insert a CheckBox.

Thanks or reporting the RichTextBox bug, we will look at it and get it fixed. Thanks!

03/08/2009 12:59
 
bwhalversen said:

Is there a documented XSD for your RichText/XML format somewhere. I would like to generate XML dynamically to feed into the control and this would be very helpful. For example, what is the XML to include a Framework element in the text? Why must a different style element be defined for every individual hyperlink in the text, and on and on...

Also, using the online demo for RichTextBox I cannot export text to HTML. Is this a bug?

03/05/2009 08:44
 
lepipele said:

Can you also add one more thing to the new version - KeyDown event for textbox isn't firing when I press 'Enter'?

I've also tried setting AcceptsReturn to both True and False, and it's not working...

03/05/2009 01:20
 
dan said:

Hi lepipele,

Its not possible to do this in the current version, however it is possible in the next version (5.1.8) which will be released shortly. Thanks!

03/04/2009 01:36
 
lepipele said:

How can I set default text (foreground) color to something other than Black (without using:

textBox.ApplyFormatting(Formatting.Foreground, Colors.White);

);

03/04/2009 11:23
 
dan said:

Hi kdsnakeware,

You are correct in that Silverlight is very restrctive on access to the system clipboard. The RichTextBox itself relies on a standard TextBox for its access to the clipboard as it is not directly accessible. As you've pointed out it can be accessed through javascript, and we are still looking to possible solutions to this challenge. Thanks!

03/03/2009 10:09
 
RichardReeder said:

Hi Dan,
I am expeciancing a strange bug with the saving out of the richtext into xaml. If I have a box with 3 lines of text, populated from xaml or typed in each time, if i make some changed to the top line and save then read in again the to pline changes are applied to the second line as well.

It seems to only happen when multiple things are changed, like font, color and background changed seems to always do this. Only changing 1 thing, like font or color always works correctly, changing 2 things sometimes works and sometimes changes the second line. I can not find any single change that always causes this.

I am guessing that somthing causes a style close and open section to be dropped, will let you know if I manage to identify anything more useful.

Thanks
Richard

03/03/2009 09:32
 
kdsnakeware said:

I'd like to be able to select a piece of a (HTML) page (incl images) in my browser, rightclick copy and richtclick paste it into the editor. Images are pasted as img tags with an abs src url.

I did some digging; Our current (DHTML/JavaScript) editor uses a contenteditable IFRAME/DIV where you get the HTML pasting ability for free, but it seems to be built into / implemented by the browser engine.

From all I found on the internet it looks like it's only possible to copy/paste text to/from the system clipboard in Silverlight 2, so this seems impossible.

Maybe it is possible to use a DIV as a proxy for receiving the HTML?

03/03/2009 12:06
 
dan said:

Hi kdsnakeware,

There is no such event at the moment, however we can certainly add such an event to a future version. Could you explain a little more about what you would like to do as the built-in paste functionality can paste from the system clipboard or RichText? Where would your HTML come from? Thanks!

02/27/2009 06:09
 
dan said:

Hi zebraxxl,

Thanks for your question. Unfortunately it is not possible to do Justify text alignment, this is a technical limitation that we are still looking at possible solutions. Thanks!

02/27/2009 06:03
 
kdsnakeware said:

Is there an OnBeforePaste event so I can influence what and how it will be pasted or do I need to buy the source for this?

I would like to be able to paste parts of a HTML page including Images.

02/27/2009 07:20
 
zebraxxl said:

Dan,
Is there any plan to make the Justify align? Or maybe there is any way to do it now?

P.S. Sorry for my English...

Thanks
Artem

02/26/2009 12:53
 
dan said:

Hi Chris,

Thanks for reporting these, the problem with the logon control is fixed and the RichTextBox/Block problem, this will be fixed in the next version. Thanks!

02/25/2009 02:03
 
cdove79 said:

P.s. on your site it says i am logged in as you, but my comments are coming from myself ;)

02/24/2009 01:23
 
cdove79 said:

Hey Dan,
I have been having issues most the night so far, The first issue is i get "Unable to convert to Rich Text" and that is when i have this: <Liquid:RichTextBox x:Name="Test" Margin="56,119,278,145" Text="Test"/> If i remove the Text Property it works fine.

Also with Dynamic RTB's i try it like this, and it works fine (ARGH is a button that will place a RTB on the page):
private void Argh_Click(object sender, RoutedEventArgs e)
         {
                _test = new Liquid.RichTextBox();
                _test.Width = 100;
                _test.Height = 100;
                LayoutRoot.Children.Add(_test);
                _test.Loaded += new RoutedEventHandler(_test_Loaded);
         }

         void _test_Loaded(object sender, RoutedEventArgs e)
         {
                _test.Text = "Test";
         }

but if i run this i get a Null Object Error Where i have put the ****

         private void Argh_Click(object sender, RoutedEventArgs e)
         {
                _test = new Liquid.RichTextBox();
                _test.Width = 100;
                _test.Height = 100;
                LayoutRoot.Children.Add(_test);
                _test.Loaded += new RoutedEventHandler(_test_Loaded);
                **** _test.Text = "Test"; ****
         }

(The _test variable is stored at the top, it will be dynamic soon, im just testing it out)
Thanks
Chris

02/24/2009 01:22
 
dan said:

Hi liz.colon,

Sure, the full demo can be found here. There is a download link below the main demo, you will need to be logged in to download the demo source code. Thanks!

02/20/2009 12:39
 
liz.colon said:

I like the prospect of using this control, but I'm not sure I understand how to use the XAML features it provides. Specifically, I'd like to see how the Insert Treeview works in the demo. I downloaded the source, but the menu is not included in the sample. Is there any way you could provide a sample snippet so I can understand how this is done?

02/20/2009 12:06
 
RichardReeder said:

Dan,
Thanks, great controls.
Think I have found another bug for you, if you add a line feed to the liquid richtextbox and save out the XAML you seem to get an additional paragraph. This means in a WPF rich text box you get a double line feed for every origional line feed.

You probably only need to close your paragraph and start a new paragraph for the next line of text, rather than adding an empty paragraph.

Thanks
Richard

02/20/2009 09:18
 
dan said:

Hi Richard,

Firstly, the problem you were having with exporting to HTML is a bug in the current version which can throw a null exception, this will be fixed in the next version.

In terms of full XAML import/export for WPF is on the cards and is simply a matter of developer resources. As you may not know this, I make these controls as a hobby and as such am the only developer resource. Hopefully sometime I can get this done. Thanks!

02/18/2009 06:59
 
dan said:

Hi Richard/ali-pmis

The issue with custom fonts is down to our TextBlockPlus control (used in the RichTextBox for all text elements) which has been fixed and will be made available in the next release along with an example of loading and using a custom font. Thanks!

02/18/2009 06:42
 
RichardReeder said:

Dan,
Is there any plan to make the XAML output 2 way? Allowing to save and restore directly into this, even make it template bindable.

I Guess there could be some good reasons why this is not possible.

Thanks.

02/18/2009 08:08
 
ali-pmis said:

dan how will we add custom fonts dynamically, fontsource property in not working.

02/18/2009 05:04
 
ali-pmis said:

my fonts folder is in my website folder, not in my silverlight project folder, so how will I specify these fonts.

02/18/2009 02:35
 
dan said:

Hi prateekrai,

This is fixed in the latest version of the controls, can you check you are using the latest version?

02/17/2009 12:07
 
ali-pmis said:

hi RichardReeder:
                                             Its good I load my custom fonts dinamically and I farward font file name and font name to applyformatting method of rich text box. but it does not apply. it applies on text block but not at rich text.

02/17/2009 09:30
 
RichardReeder said:

Dan,
I am having a few issues retrieving the HTML from the richtext boxes. I put just some simple plain words in and try to save out, on a break point I can get the RichText xml no problem, I can see my text in there. However if I try to query the HTML of the same richtext box I consistently get an error thrown "Nullable object must have a value" or invalid operation exception. It only seems to happen if some HTML is read into the Richtext box from xaml first, then trying to read it out again causes the error. A Richtext box starting with an empty text works fine.

The HTML I am putting in through XAML is the HTML output from the Richtext box previously, it displays correctly with no problem and can be edited on screen with no errors, as before the xml output works, just the HTML output fails.


02/17/2009 09:30
 
ali-pmis said:

and can we make all text bold Italic and underline without selecting it.

02/17/2009 09:12
 
RichardReeder said:

Ali,
I use my own fonts, you have to package them in silverlight as you can find on the silverlight help. Then i just do this

<ComboBoxItem Content="Amandas Hand" FontSize="14" FontFamily="fonts/AMANDA-H.TTF#AmandasHand" />
<ComboBoxItem Content="Freestyle Script" FontSize="14" FontFamily="fonts/FREESCPT.TTF#Freestyle Script" />

_currentTextBox.ApplyFormatting(Formatting.FontFamily, ((ComboBoxItem)selectFontFamily.SelectedItem).FontFamily.ToString());

There is an outstanding issue that something on your silverlight page has to use the custom font before the richtextbox wil use it.

02/17/2009 09:06
 
ali-pmis said:

Like if I have my own font files and I want to use these fonts in rich text box

02/17/2009 06:32
 
ali-pmis said:

Can we use custom fonts with rich text as we use with simple text in silverlight.

02/17/2009 04:53
 
prateekrai said:

Hi dan,
Tab Index property for rich text box is not working properly.
So is there any way to set tab index for rich text box.

Thanks in advance.

02/16/2009 08:54
 
dan said:

Hi cdove79,

Thanks for your comments. A point to remember is the RichTextBox inherits from the standard TextBox control which uses SelectionStart and SelectionLength for its own internal processes. The RichTextBox cannot re-use these properties which is why we have ContentSelectionStart/Length for the same purpose. Thanks!

02/13/2009 03:41
 
cdove79 said:

Please ignore my comment, except the Great control part, i realised its ContentSelectionStart and for the end, ContentSelectionStart + ContentSelectionEnd and not SelectionStart and SelectionLength My foolishness!
Still AMAZING control.

02/13/2009 01:29
 
cdove79 said:

Hey Dan,
Correct me if im wrong, but is there any way to find out the current location of the cursor, e.g. its 89 characters in to the document.
Great control thought :D

02/13/2009 01:25
 
dan said:

Hi ali-pmis,

This is a bug and we have added it to the fix list for the next version. Thanks!

02/13/2009 12:14
 
dan said:

Hi symon,

In XML an indent is not represented by a style, instead it is simply a bullet with Type="Indent".i.e.

<Xaml><liquid:Bullet Type="Indent" Number="1" /></Xaml>

With regards to the bug, we have added it to the fix list for the next version. Thanks!

02/13/2009 12:12
 
ali-pmis said:

and auto increasing height and width properties will make richtextbox an amazing control. try to include it early.

02/13/2009 09:53
 
ali-pmis said:

Maxlength property doesn't work

02/13/2009 09:42
 
symon said:

sorry for putting yet another post, but here is another indentation question. since i was trying to indent text and then see the rich text that was generated to see how it is represented in rich text xml. but before i could get to it, i noticed a bug.
here is the steps to reproduce it:
create 3 lines
hello1
hello2
hello3

indent the 2nd line once
indent the 3rd line twice
when you indent the 3rd line you will notice the 2nd line also indents, which shouldn't happen. Can you please look into this. Thanks

02/13/2009 08:45
 
symon said:

Sorry i hit the F5 button and it reposted my last comment. please ignore it. however, i do have a new question:
I am generating the RichText XML on programatically. now how is indentation represented in rich text xml. the style element has alignment attribute but it doesn't not have any indentation attribute. secondly more then one text element can be in a single line, both text elements defining different style where each style has different alignment. which alignment wins since alignment is by line. Thanks

02/13/2009 08:35
 
symon said:

Hi Dan
we are paid subscriber. we download the rich text box example. but its no longer like the full blown version as pictured. its only offer the basic bold, italics, etc... Can you please repost the example with all those functionalaities as listed above.
Thanks
P.S. i want to find out how to programatically indent

02/13/2009 08:32
 
dan said:

Hi symon,

Sure, the full demo resides here, you need to be logged in,below the demo is the link to download. Basically to indent you call:

richTextBox.ApplyFormatting(Formatting.Indent, null);

There must be some content selected for this to work. Thanks!

02/12/2009 07:04
 
symon said:

Hi Dan
we are paid subscriber. we download the rich text box example. but its no longer like the full blown version as pictured. its only offer the basic bold, italics, etc... Can you please repost the example with all those functionalaities as listed above.
Thanks
P.S. i want to find out how to programatically indent

02/12/2009 03:59
 
dino said:

Hi Dan,
The paste feature is greate ,but there are some problem with exporting html

1.                 string result = richTextBox.HTML;
                     richTextBox.HTML = result;
                     //getting after setting
                     return richTextBox.HTML;//System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
2.Sometimes the richtextbox export html with wrong format,import the wrong format string will throw a exception.how can I try the exception?

Thanks

02/11/2009 09:12
 
RichardReeder said:

Dan,
Regarding the non-standard fonts, if I get something to use the font before loading the rich text box from xaml it uses the font correctly. The problem is only when the rich text box is the first thing to try and use the font.

Hope this helps.

02/11/2009 05:35
 
dan said:

Hi Jin,

I will look further into your VB conversion problem and let you know what the problem is soon. The Rich TextBox doesn't yet support Chinese character input, it is something we will look into. We do have Korean IME input so it may be possible in the future. Thanks!

02/10/2009 11:47
 
dan said:

Hi Richard,

Thanks for raising these issues. With regards to your problem with non-standard fonts, there may be a problem with the FontSource properties not being set, we will look into this further.

The problem you're having with the bulleted lists is a new bug which we will get added to the fix list for the next version.

Getting/Setting the content as HTML is just as efficient as the native XML format (RichText property), in previous versions the HTML import/export was a separate process, however it is now fully integrated with the Rich TextBox. Thanks for your post!

02/10/2009 11:43
 
dan said:

Hi ali-pmis,

At the moment there is no easy way to count the number of characters in a line, however maybe it is something we can add in a future version. Thanks!

02/10/2009 11:34
 
jin.yuan said:

Hi, dan: I was trying my luck with foreign language input with your control. I set my system language bar to Chinese, move the cursor to RichTextBox, once I type the Chinese input, the input bar does show in your text box. (wish I could send you the screen shot). But once I selected Chinese char. it is not pasted to textbox. I know it is not supported at this time. Do you think you will put this feature in in the future? It seems so close to get it now. Thanks!
Jin

02/10/2009 07:03
 
jin.yuan said:

Hi, Great control! Since my project is in vb.net, I converted your code to vb.net. I am having 2 problems. Your demo project works fine. So I think I did someting wrong.

1. The main menu items are showing, but menu items are not when I click on main menu items. I downloaded newest dlls (5.1.7). Where should I look at to fix it?
2. The speller is not working for me. It always returns null value for the stream. I copied dictionary folder right under my project (myProject, it is also the namespace) folder.
_spellChecker = New SpellChecker((Me.[GetType]().Assembly.GetManifestResourceStream("myProject.dictionary.en-US.dic")))
Thanks!

02/10/2009 06:15
 
RichardReeder said:

The new control looks great, like the paste feature.

I am trying to save out the HTML output into xaml, through html encoding, which is working fine. However trying to regenerate the xaml from the HTML text output I have a few issues.
Fonts that are not the standard embeded fonts dont seem to restore, though the saved out style has them and they work in the origional box. Is there some method for adding fonts to the rich text box?
Also if i make bullet points using different colours or fonts on each line they change bullets depending on when you apply the font / bullet. Restoring them from HTML or XAML output does not re-create them in the same way as either way they are created.

Is getting and setting the HTML a reasonable thing to be doing? The reason for doing it this way is I need to save work in progress xaml project, open it again and finally re-create this in a WPF rich text box.

02/10/2009 04:45
 
worldvibe said:

I added <Setter Property="Foreground" Value="#FF000000" /> to the generic.xaml and added a TemplateBinding to the ElementSuggestions combobox for both RichTextBlock and RichTextBox.

<ComboBox x:Name="ElementSuggestions" Foreground="{TemplateBinding Foreground}" Canvas.Left="8" Canvas.Top="30" Width="150" />

02/09/2009 05:23
 
ali-pmis said:

Can we count number of characters in a line

02/09/2009 06:30
 
jin.yuan said:

Thanks, Dan: I saw the new release with copy/paste feature. Thanks so much for the new release! It is realy on time!
Jin

02/09/2009 05:49
 
dan said:

Hi Daniele,

The problem you have here is that all text elements must be enclosed in a CDATA tag, for example:

<LiquidRichText xmlns:liquid="clr-namespace:Liquid;assembly=Liquid.RichText">
<Style ID="dummy" Foreground="#FFFF0000" FontSize="18" FontWeight="Bold" />
<Text Style="dummy"><![CDATA[This is a sample.]]></Text>
</LiquidRichText>

Hope this helps!

02/08/2009 10:35
 
Daniele Fusi said:

Hi, this looks like a great control but I cannot manage to let it display some programmatically generated XML rich text. It seems that even this online demo does not work as expected, unless of course I'm doing something wrong. Here's how to reproduce the issue:

1) in the demo above, select all the text and delete it.
2) File/Import: paste the following XML rich text, select XML and click GO. Nothing happens, the control contents remain blank.

XML:

<LiquidRichText xmlns:liquid="clr-namespace:Liquid;assembly=Liquid.RichText">
<Style ID="dummy" Foreground="#FFFF0000" FontSize="18" FontWeight="Bold" />
<Text Style="dummy">This is a sample.</Text>
</LiquidRichText>

In my application I need to display some readonly rich text so I was planning to use the RichTextBlock, but I'm stuck with this issue, nothing is displayed when setting the RichText property. Is this my fault or a bug in the control?
Thanks!

02/08/2009 06:22
 
dan said:

Hi ali-pmis,

If you want a RichTextBox that automatically increases in height as you type then you can use a RichTextBlock with the IsReadOnly flag set to False. We are still assesing whether we can do the RichTextBlock with automatic expanding width. Thanks!

02/07/2009 07:24
 
dan said:

Hi Jin,

Apologies, what I meant to say that copying/pasting to the system clipboard is a feature in the next version of the controls library which we will release at the end of February. Thanks!

02/07/2009 07:21
 
jin.yuan said:

Hi, Dan: Thanks. I tried to copy from notepad and MS word (english characters). But the paste button in richtextbox does not copy it over. Only the characters previously on RichTextBox's clipborad got copied. Did I do something wrong? Please advice. Thanks.
Jin

02/06/2009 05:18
 
dan said:

Hi jin.yuan,

In the current version no, however we have support for copying/pasting to/from the system clipboard (notepad, word etc) which should help you. Thanks!

02/05/2009 11:26
 
ali-pmis said:

hi, dan I am waiting for you to make richtextbox height and width auto increase when typing as it happens with textbox in silverlight. when this funtion will be available aproximately what date.

02/05/2009 08:12
 
ali-pmis said:

KeyDown event don't fires when we press enter.

02/05/2009 06:48
 
jin.yuan said:

Hi, Dan: Is there any way to input foreign characters? I can't copy from MS words doc and paste it here. Is this supported or I just did not find the right way to do it? Thanks!

Jin

02/05/2009 05:12
 
dan said:

Hi e.beckers,

Thanks for these suggestions, the base work for implementing keyword hilighting is there (text input pattern matching) so I think this is a good candidate for a future version. Thanks again!

02/04/2009 12:52
 
dan said:

Hi Martin,

Glad you like the controls and your suggestion certainly merits consideration for a future version. As you've pointed out there is no way to "link" RichTextBox instances though we can nest editable RichTextBlocks in a RichTextBox as we'ver done with the Table control. Thanks again for posting your ideas!

02/04/2009 12:49
 
dan said:

Hi Romain,

There is no property to completely disable text wrapping however you can try setting AutoWrap="false" and WrapWidth="10000". When AutoWrap is true the wrap width is based on the width of the control, setting this to false the WrapWidth value is used.

When setting content you should always use the RichText or HTML properties, the Text property is a legacy setting and is there because the RichTextBox inherits from TextBox which has this property.

I will look at the issue with the carret size and will get back to you. Thanks for your post!

02/04/2009 12:45
 
e.beckers said:

Some suggestions for this great control:
- inserting/embedding images/videos with text wrapping around the image/video
- syntax highlighting so we can use it as a visual studio look a like code editor

02/03/2009 01:45
 
martinoosthuizen said:

Hi there. Thanks for the latest update. It fixed a lot of things I was battling with.

Now another idea:
I'm using your controls in a sort of Word-Processing context, and page management has taken me quite some time to accomplish.

What do you think of including a feature that allows text to overflow into another RTB?
Like you would specify another RTB as the "overflow target", and that would automatically raise an event (for custom code) when the RTB is full (based on numoflines or some such thing), and it will take the cursor to the new page (which may be spawned in the event handler, or may already exist) and grab the overflow and place it on the next "page".

Just a thought. That's a lot of ground-work if you do it the way I've done it.
But if the logic could exist in the control to move text back and forth on controls in some pre-determined order, I think it opens up the control to a new range of applications as well. And it'll obviously save others a load of time.

Still lovin all these controls. Thanks man!

Regards
Martin

02/03/2009 02:14
 
RomainP said:

Hi,

I'm using your RichTextBox to edit XML code. In this particular case I'm not using any of the styling or formatting, but still find features like Find or Undo very useful!

I want to set a fixed-width font and disable any wrapping, but can't seem to make it work. The caret always take more than one line, and it is impossible to edit the text easily. Which properties should I use: Text? RichText? How can I completely disable line-wrapping? Finally, what is the difference between AutoWrap and TextWrapping?

Thanks for putting these great controls together and for the support!

02/02/2009 11:47
 
dan said:

Hi seavista,

The demo download on this page is a simple starter example, a more complex demo can be found on the full demo page. There is a link to download the full demo at the bottom of the page which you will need to be logged in to see. Thanks!

02/02/2009 09:46
 
seavista said:

I notice the screen shot (above comments) of your sample has much more funtionality displayed than is in the demo with download.    Any way to post that sample for reference, much appreciation. Or am I missing the full documentation? Thanks!


02/02/2009 09:08
 
dan said:

Hi ali-pmis,

Not in the current version, however this is a good suggestion and one which we can get implemented in the next version of the controls library. Thanks!

01/30/2009 11:31
 
ali-pmis said:

Hi is there a way that richtextbox height and width auto increase when typing as it happens with textbox in silverlight. waiting for your reply.

01/29/2009 06:34
 
dan said:

Hi dvalenzu,

The import/export to HTML is still early in development and does not support all tags but it is being improved all the time and should be able to handle these in the next version. Thanks!

01/21/2009 01:20
 
dan said:

Hi hcalx,

Yes, you can use the following:

RichTextBox.Bottom();

This positions the cursor at the end of the document. Thanks!

01/21/2009 01:19
 
dan said:

Hi ali-pmis,

Thanks for reporting this, we will get this fixed in the next version. Thanks!

01/21/2009 01:17
 
dvalenzu said:

I cannot import something basic like <b> this </b> <i> is </i> a test
Witch should display (bold) this (italic) is (normal)a test
Do you know if this is something with the parser?

01/18/2009 06:49
 
hcalx said:

Hi :)

Is there a way to scroll to the end (to the last line) of the richtextbox from code?

01/17/2009 01:43
 
ali-pmis said:

MouseLeftButtonUp evevnt of RichTextBox and RichTextBlock dont fires and can we provide line spacing to user.

01/16/2009 06:30
 
dan said:

Hi martinoosthuizen,

These are good suggestions that I will get added to the feature list for future versions, in the mean-time the number of lines in a document can be found using:

richTextBox.Panel.Rows.Count

This property only works when the Rich TextBox has been rendered, we will get a better solution implemented in the next version, you will also need a method for scrolling to a specified line number, this should be easy to implement as well in the next version.

Thanks again for the suggestions!

01/12/2009 10:16
 
dan said:

Hi Sean,

In version 5.1.4 there is an export option to XAML which is compatible with the WPF Rich TextBox, let us know if there are any other import/export options here. Thanks!

01/12/2009 10:11
 
dan said:

Hi jthg,

Thanks for reporting this bug, it has been fixed in version 5.1.5. Thanks!

01/12/2009 10:08
 
martinoosthuizen said:

Hi There. Great Library!
Just wondering, is there any simple way to get the number of lines in the document, without having to iterate through each line and count?

I'd like to implement a "goto line <number>" feature, as well as a page seperator, that will logically seperate pages based on the paper size chosen by the user. For the latter feature, I would especially need a "number of pages property", because it would take a huge toll on the user experience if I were to navigate up and down the document to re-arrange content.

Do you foresee any such addition, that will logically flow from one box into the next based on a selected page size?

Regards

01/12/2009 02:50
 
sean.riedel said:

Hi,
I am wondering if there are any other export options other than HTML? I am exporting the rich text, sending to to a WPF webservice, where I have to recreate the Silverlight canvas in WPF so it can be converted into a JPEG image. I haven't been able to use your RichTextBox control in the WPF webservice so I figured I would just use the built-in Microsoft Rich Text Control, however it only seems to really support XAML importing, but not HTML.

Thanks.

01/05/2009 12:25
 
jthg said:

Hi,

I came across an "argument was out of the range of valid values" error in the demo. To reproduce:

1. Delete everything in the demo
2. Type four (random) characters
3. Click the bold button
4. Type four more (random) characters
5. Select the first two characters and press ctrl-c
6. Put the cursor at the end of the line and press ctrl-v

01/04/2009 12:49
 
dan said:

Hi nbarten,

Thanks for the posts, indeed the RichTextBox does use character code 10 instead of 13, this will be fixed in the next version. When the Rich TextBox is empty it will return a newline, it's on the list to be looked into to see if any fix is needed here.

And your final post is a bug which I've put on the fix list for the next version. Thanks for your contributions!

12/26/2008 06:53
 
nbarten said:

Hi,

Sorry that this is my third post already, but i found a bug:

1 - Delete everything in the demo, type some text;
2 - Click on the Bold button (or some other will do i think like italic)
3 - Type some more text;
4 - Remove the text typed at step 3 with the Backspace key;
5 - When the last character of the typed text at step 3 is removed a new space will appear???
6 - Remove the space with the Backspace key;
7 - Type a new character. The new character appears at the start of the text???

I found this bug when using the ApplyFormatting method without anything selected. It's quite weird.

Happy new year!

12/26/2008 01:51
 
nbarten said:

well finally found it.

Somehow the rich textbox uses char(10) as a newline, while the normal textbox uses char(13).

byte newline = 10;
txtInput.Text = txtInput.Text.Replace((char)newline, '*');

String replacement with Enviroment.Newline, "\r\n", "\r" or "\n" didn't work somehow.

Also still a question. When nothing is in the rich textbox yet, it still gives back a newline?

12/24/2008 02:15
 
nbarten said:

hi

I tried to use the String.Replace method (txtTest.Text = txtTest.Text.Replace(Environment.Newline, "@") ), but somehow it didn't work. With other methods such as LastIndexOf it couldn't find the newline.

I tried basically everything i knew, /r/n, /n, /r, Environment.Newline, even \n... but none worked.

I tried this with the normal TextBox component, and then it worked normally.

So i wonder if i'm doing something wrong.

12/24/2008 01:23
 
dan said:

Hi adinaesma,

Thats a good suggestions and one I'm sure which can be implemented in the next version. Thanks!

12/20/2008 11:18
 
dan said:

Hi Manor,

There are methods in a static class Liquid.Components.Html such as ConvertRichTextToHTML() which handle basic RichText to HTML conversion. As I said, you cannot do this using DataBinding at the moment but you can still convert it with a call to this function. As I've said these are basic conversions to and from HTML. Thanks!

12/20/2008 11:14
 
manor said:

Dan,

We do not have an option of storing the output as Rich text XML. Another application uses the same database field and html within it. We have to store it as HTML and import as HTML. :)

12/20/2008 06:09
 
drbarton said:

I've solved my problem. The real problem was that when you press the key <Alt Gr> it don't give the focus to the RichTextBox so the combination of keys doesn't work. I've just add an event keyPress on the RichTextBox and do for all keys : richtextbox.ReturnFocus() and it works fine
Regards

12/16/2008 07:38
 
adinaesma said:

Hello, what about the feature of automatically recognize URLs? Is this feature supported?
Thank you!

12/15/2008 09:14
 
drbarton said:

I'm under Windows XP SP3 I use Firefox 3.0 (Same problem with IE 7) and have the 2.0.31005.0 of silverlight. The problem is that all the characters that need the <Alt Gr> touch to print them in the RichTextBox can't be used
(I'have a french keyboard)
Thanks

12/15/2008 08:38
 
dan said:

Hi manor,

As the conversion from RichText to HTML is computationally expensive it is not possible nor recommended that a solution using databinding should be used for this. It would be best to store the output of the Rich TextBox as RichText XML. Thanks!

12/14/2008 10:46
 
dan said:

Hi drbarton,

As far as I'm aware all characters should be usable, I have just tested the online demo and the # character is available, could you let us know more information about the environment you are running in? Thanks!

12/14/2008 10:44
 
manor said:

Hi Dan,

Does it now support databinding from a html field value in a database?

Thanks!

12/14/2008 07:52
 
drbarton said:

Hi I wanted to know haw to provide the sharp character (#), I need thi. And is there any other characters that we can't use.
thanks

12/11/2008 05:29
 
dan said:

Hi rlee,

Thanks for reporting these, I'll get them on the list to be fixed, hopefully in the next version. Thanks!

12/02/2008 09:35
 
dan said:

Hi rolf-rostig,

The property richTextBox.RichText gets the content in its native XML format, from there you can either write the file to the local users machine or maybe transmit it back to the server using a web service. Let us know which of these methods you need more info on?

12/02/2008 09:34
 
rlee said:

This is really great and thank you for providing this rich editor for free!
I have question spellcheck functionality. Currently it doesn't recognized numbers greater than 10 and Proper Nouns so those are underlined with red. Is there a way to make it ignore the numbers and Proper Nouns?
Thank you very much!

12/02/2008 03:49
 
rolf-rostig said:

Hi,

is the control provided for write to the xml-file?
If yes, please tell me a example.

Thanks,
Rolf

12/01/2008 06:22
 
karnqu said:

Didn't think of trying that, worked great thanks

11/28/2008 07:39
 
dan said:

Hi Jake,

At the moment no, you can achieve the same using Width="Auto" Height="Auto". Let us know if this doesn't work for you, thanks!

11/25/2008 10:55
 
karnqu said:

Doesn't appear that the rich text box control supports HorizontalAlignment="Stretch" or VerticalAlignment="Stretch", is this true or am I using it incorrectly?

Thanks,
- Jake

11/25/2008 08:44
 
dan said:

Hi vijeshmv,

We are aware of this bug and it is being worked on. To keep you informed, this bug has had a longer resolution cycle than others and was not ready for 5.1.2 which is why it is still present in this version. As we receive new bug reports on a daily basis, our aim here is to issue updates on a regular basis with whatever fixes are ready at that time. Thanks!

11/23/2008 10:11
 
vijeshmv said:

Here is a simple testcase for the Richtext box of Vectorlight

1.)Open http://vectorlight.net/silverlight_rich_textbox_demo.aspx
2.)Delete all content from RichTextbox by following keys
                     Ctrl+A and press the Delete key in keyboard
3.)Enter 1 in Rich textbox and press enter
4.)Enter 2 in Rich textbox and press enter

5.)Select the entire data in Rich textbox using mouse.

6.) Click Bullets Icon
7.) Click NumberList Icon

8.) Click Bullets Icon
9.) Click NumberList Icon

10.) Click Bullets Icon
11.) Click NumberList Icon

12.) Press Ctrl+Z

The Rich Textbox sample will crash. I am soo sorry to say that Vectorlight team couldnt fix this bug yet.

11/19/2008 12:57
 
dino said:

Thanks for help

11/18/2008 09:56
 
dan said:

Hi dino,

At the moment a newline is inserted at the end of each line in the Rich TextBox, this will vary depending on the size of the TextBox. The conversion to HTML is still in it's early stages however it is an enhancement which we will try to implement in the future version to output <p> tags instead of <br />.

11/18/2008 12:35
 
phoenixx said:

Cool, Thanks.

11/17/2008 11:07
 
dan said:

Hi Pheonixx,

Thanks for the suggestion. Tables are not supported at the moment, though I agree having such functionality would be great which is why I have added this as a possible future enhancement. Thanks!

11/16/2008 08:19
 
phoenixx said:

Hi dan, excelent controls suite. but i dont found - how i can insert table into RichTextBox, and after that make export to html with correct table tags.
Thanks :)

11/13/2008 12:04
 
dino said:

Hi dan:
Export the rich textbox-text to a html ,the rich textbox will create some new lines.How can I export to Html without new lines?
Thanks.

11/11/2008 07:58
 
dan said:

Hi Jerry,

There is an event called LinkClicked which is fired when a link is clicked, in the demo we do the following to open a new browser:

System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(e.Parameter), "_blank");

Thanks!

11/07/2008 03:56
 
chordia said:

How does one get notified that a link has been clicked? Might be a useful addition to the demo.

The RTE looks like a nice piece of code. Thanks

Jerry.

11/07/2008 06:10
 
dan said:

Hi Paul,

Yes the RichTextBox is contained within a ScrollViewer by default.You can scroll to the bottom of a RichText document programatically by calling the testRichTextBox.End() method which simulates a CTRL+END key press. Thanks!

10/30/2008 05:03
 
pbelin said:

Is it possible to raise an event that scrolls to the bottom of the box ?

I tried to embed the richTextBox in a scrollviewer but the control doesn't adapt his size like a common textbox, and adds its own scrollbar.
This might be a point of improvement for the future !

Thanks,

Paul

10/29/2008 08:24
 
dan said:

Hi,

Thanks for letting us know, I have updated the download file. Thanks!

10/20/2008 07:18
 
tatabarla said:

hi,
Seems the RichTextBox example link still uses Liquid DropDownList and TextBoxPlus objects. Can you please provide updated example code?
Thanks,
TB

10/20/2008 02:50
 
dotnutshell said:

Hi,
Still waiting for a proepr RichTextBox example with source code.

10/20/2008 02:02
 
dan said:

Hi Martin,

Thanks for all your reports. Hopefully these are all now fixed in version 5.1.0 which is available now. However, please let us know if anything has been missed. Thanks!

10/16/2008 02:54
 
m.wawrusch said:

ANother one:
Create a new rich text box.
Press Backspace twice
Press return

and you will get an index out of range error.

Thx
Martin

10/06/2008 08:27
 
m.wawrusch said:

A bug related to Left/Center/Right:
This is a paragraph (or at least line) level operation, which works fine if the selection is of length zero or includes all elements in a line. It does not work well (it actually produces erroneous results) when used on a partial selection within a line. In that case it would make sense to still treat the whole line (or multiple lines) as one unit.

Teh selection logic needs to include a mouse capture so that the selection continues even when the mouse leaves the rich text area.

Thanks
Martin

10/04/2008 10:23
 
m.wawrusch said:

Some more bugs
When creating an empty text box, it initially consists of 2 lines of text, and when you click into it the caret is positioned at the second line.

Create a richtextbox with 2 lines, and click on the area right after the word wrap in line 0, then slightly move the mouse down while pressing the button. There is a short moment where the selection polygon is a diagonal bar from row 0 to the right to row 1 on the left.

10/04/2008 09:02
 
m.wawrusch said:

After working a little bit with the control I do have a feature request and a couple of potential bugs:

Please make ApplyFormatting accepting a Brush as the foreground property. I don't need the ability to save it but just to set it and retrieve it.

Also it seems that the algorithm for the word breaks does not go to the far right but stops maybe 15 to 20 pixels to the right.


Thanks
Martin

10/04/2008 08:40
 
dan said:

Hi m.wawrusch,

Yes, we are aware of RC0 being available. We are updating at this very moment and will have an updated library soon. Thanks for your patience at this busy time!


Hi dino,

Yes, we are aware of a few bugs such as right-to-left text typing under certain curcumstances and these are being fixed now. If you could list the issues you are having here then we can get them resolved. With regards to your problem importing XML, I will have a look at this now and let you know how to do it soon. Thanks!

Hi sandero,

I will review your questions and reply when I have the correct answers for you. Thanks!

09/27/2008 10:31
 
m.wawrusch said:

RC0 is out now, can you provide updated libraries please:

Exciting news! In preparation for the upcoming release of Silverlight 2, we have released Silverlight 2 Release Candidate 0 (RC0) to developers to start the process of updating their code. Scott Guthrie just wrote about this in his blog yesterday. All of the details, including a breaking changes document are here http://silverlight.net/GetStarted/sl2rc0.aspx and here. As I have written a number of samples that use Silverlight 2 Beta 2, I will be going through this process with you as well – and blogging about it. When you encounter problems, your first resource should be the forums on the Silverlight.net site. If you can’t find what you’re looking for there, please feel free to contact me directly.

Sincerely,

09/26/2008 10:11
 
sandero said:

Hi,

One addition problem/request for the control.

- It would be nice when you add several www links into the RichText that all the links can point to different websites, now all links will open the first web site.

Greetings Sander

09/26/2008 12:35
 
sandero said:

Hi,

This control has great functionality but I encounter several problems when using it.

1. Visual Studio 2008 hangs when I change the Visual appearance and rebuild the solution. This occurs especially when I try to create a control library with the RichTextBox in it. Inherritance seems to be the cause.
2. When I save richt text with custom formatting as Html (Export function) and load the Html back into the control an error occurs when I try to apply custom formatting again to the loaded text. It seems that the number that keeps track of how many Custom styles are used is not update when text is loaded into the control and the control wants to create again style Custom1 which is already present in the loaded text.
3. When the control is used on a deeper level for example <Grid><Grid><Canvas><StackPanel><Grid> some strange behaviour occurs (e.g. Cannot use Enter anymore, selection is lost)
4. When used in a custom control and control is just initialized I sometimes get an error when I directly use AlignCenter without any text typed on the ApplyFormattingBySelection method. This seems to have to do with the fact that nothing is selected and the control cannot apply formatting yet,

09/25/2008 06:33
 
dino said:

Thanks for the control.

When I import XML like this:
<Text Style="Default"><![CDATA[333333333]]></Text>
<Text Style="Custom0"><![CDATA[333333333333333]]></Text>
<Text Style="Default"><![CDATA[333333333333333333333333333333333333333333333333333333333333333333333333333333]]></Text>

The richtext will be two lines.How can I so this string in a paragraph normally?Any suggestions?

09/24/2008 01:09
 
dino said:

There ate so many buys with changing text format.

09/23/2008 03:02
 
dan said:

Hi Vijesh,

Thanks for reporting this. We have added it to the issues log which we will implement fixes for in the next version. Thanks!

09/17/2008 10:58
 
vijeshmv said:

Hi Dan,


I got a bug in your example of RictText Box. Go to http://www.vectorlight.net/silverlight_rich_textbox_demo.aspx.
Select The contents of Richtext box by using key combination Ctrl + A and press the delete button in keyboard. Now try to enter some text in the richtext box. You can see the richtext box control's text is getting entered from right to left like in Arabic language. How can we fix it ?

Vijesh

09/16/2008 09:19
 
dan said:

Hi Manor,

Glad you like the control, the XML file used in the demo should reside in the root of your project and included in your project as a resource otherwise you will get an exception. You do not have to populate with an XML file, that is just the way we did it for the demo.

In terms of databinding, this is not supported at the moment and is being looked at at this very moment, stay tuned for future updates on this subject.

The RichText property needs RichText in our custom XML format, this is fairly self explanatory when looking at the sample XML provided with the demo, but I am looking to do a proper tutorial on this format in the coming days.

You cannot directly insert HTML into the RichTextBox, RichText can be converted to and from HTML using a static class which is provided with the main control dll. This is demonstrated in the example download.

You can use the Text property if you simply want to apply a block of plain text, for example:

myRichTextBox.Text = "Some text...";

Hope this helps!

09/14/2008 11:35
 
dan said:

Hi Guys,

The issue with the control crashing when using multiple instances is fixed in 4.9.2 and also the first 3 characters being immune to deletion is also fixed in this version, head on over to the download page for the latest version!

09/14/2008 11:27
 
manor said:

Thanks for the control! I tried to use this my solution.
A couple of questions!
Where should the xml file reside? I am getting file not found exception.
Also, how to databind this control? I want display the value from database into this control, update and save back.
I also tried richTextBox.RichText = "This is a test!"; or richTextBox.RichText = "<b>This is a test!</b>"; but the textbox does not get this value.

Any suggestions?

09/14/2008 11:08
 
dan said:

Hi master2385 and lsuen,

Thanks for reporting this, it seems this bug has been introduced since the recent control re-write, we have fixed this and will be issuing a modification to the Liquid.dll in the coming days. Thanks for your help!

09/11/2008 10:34
 
master2385 said:

we have the same problem of lsuen@l2soft.com

09/11/2008 06:09
 
Lawrence Suen said:

In the demo posted, I cannot delete the first 3 characters in the textbox, the rest of the characters are fine.

09/09/2008 10:04
 
pepe007 said:

I'm having a similar issue that gjduk reported on Aug 12. I'm using the RichTextBox control in a UserControl that is nested 2 or 3 layers down other container UserControls.

The cursor behaves erratically and when I'm able to position it in the RichTextBox area it will not allow me to input any text, as if it's not listening to the keyboard at all. However, the KeyDown event is triggered and handled properly by the event handler.

I also made sure that event bubbling was not causing the parent UserControls to get focus but indeed the RichTextBox had Focus when (attempting to) typing new text.

Note that you can edit the existing rich text in the control. You just cannot delete or type new text.

I'm using version 4.9.0.28796. Thanks!

09/01/2008 08:53
 
dan said:

Hi duwke,

Using your example, and changing the TextBoxPlus to a RichTextBox you would use something like:

<my:RichTextBox RichText="{Binding richText}" ></my:RichTextBox>

It's important to not the RichText property only accepts RichText XML and the Text property only plain text.

Let us know if you're still having problems!

08/22/2008 05:15
 
dan said:

Hi jesusgarza,

Thanks for reporting this bug, we will try to get this fixed for the next version!

08/22/2008 05:13
 
duwke said:

Is there a way to use the control within a template, and databind to it?
For example, I'd like to do something like...
<ListBox x:Name="lb">
                     <ListBox.ItemTemplate>
                         <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                     <TextBlock Text="{Binding timestamp}"></TextBlock>
                                     <my:TextBoxPlus Text="{Binding richText}" ></my:TextBoxPlus>
                                </StackPanel>
                         </DataTemplate>
                     </ListBox.ItemTemplate>
                </ListBox>
thanks!

08/16/2008 05:47
 
jesusgarza said:

If you export as HTML some text that includes an apersand (&) and then import the same HTML you get an error.

08/14/2008 02:26
 
dan said:

Hi,

Thanks for reporting this problem, we will have this investigated and we'll let you know the outcome!

08/12/2008 10:45
 
gjduk said:

I have been using this Rich Textbox control for a little while now, but I can not seem to get it working correctly in a ScrollViewer control. The text cursor does not get displayed, and also you are unable to edit the text. Just wondered if this was me or is there a problem

08/12/2008 05:39
 
dan said:

Hi All,

m.wawrusch:
This is a bug which we are aware of and will put a fix in place for the next version. Thanks for reporting this!

Innerswirl:
Text justification is on the cards for a future release, hopefully in time for the next version. Thanks for your suggestion!

djwag:
Yes, this can be implemented and we will try to get this in the next release. Thanks!

Kim Jin Kwi:
Unfortunately there is no support for the Korean Language at this point, we'll see what the dev guys think. Thanks!

Paul Fretter:
This bug is releated to the issue raised by m.wawrusch and we'll have a fix in place for the next version, thanks for the post!

08/08/2008 11:33
 
Paul Fretter said:

Hi all,
Great work, I need a basic HTML editor, and with the basic RTF<->HTML conversion, this will suffice.

The main issue I have at the moment, is that I want to include this in a user control, and I tend to add the user controll programatically to a parent grid's children (_parent.Children.Add(this)) and remove it when I am finished with the control.

Any User control where I include the rich text box editor, causes a ManagedRuntime Error #4004 when I remove the user control from its parent in this way.

08/08/2008 10:49
 
Kim Jin Kwi said:

it doesn.t work Korean Language...

how can i use??

08/07/2008 11:52
 
djwag said:

This control doesn't have the feature to select any portion of text through lines of code....     Can you please add Selection Start and Selection Length or Selection End Properties which support both get and set values in future releases... Better if you can include select method too that exists in a windows forms rich text box control...

08/07/2008 09:23
 
Innerswirl said:

Hi! Any chance to see justify text alignment support really soon?
http://www.cs.tut.fi/~jkorpela/www/justify.html

Great work!
Thanks in advance,
Innerswirl

08/07/2008 05:59
 
m.wawrusch said:

I also get a 4004 error, when removing the richtextbox from the parent panel. THe error has something to do with a timer within the richtextbox that invokes Timer_Completed.

08/06/2008 12:54
 
dan said:

Hi,

Thanks for reporting this. We have identified this as a bug and a resolution is in progress. Thanks!

08/04/2008 05:32
 
erlangshen said:

Hi!

When I put the rich text box in a tab item inside a tab control, the Page is giving me a javascript error 4004. Is this control not compatible with the built in silverlight tab control yet??

08/03/2008 10:37
 
dan said:

Thanks for your comments!

In terms of which properties are serialized to XML, the only properties are:

Width/Height, Source (Images only)

When converting from XML to RichText, as you rightly guessed any XAML specified is passed straight to a XamlReader which instantiates the object with whatever properties you set in your XML. More information about this can be found at Handling XAML Objects.

Hope this helps!

08/02/2008 09:35
 
IAmMonkeyBoy said:

Thanks for the quick response about using the event to handle conversion to XML. That appears to work.

Is there any documentation that shows which Properties of UIElements are and are not placed in the XML?

Second, do I have to take the same approach when going from XML? Or more clearly, do I need to set properties that the RichTextBox control does not handle? It would appear that I don't have to do that for the Background of the Canvas. Are you using the XamlReader to create the objects?

This set of controls is really nice and seems to be the most mature that I've seen so far. Great work.

07/30/2008 08:36
 
dan said:

Hi,

At the moment not all properties are recorded as it would not be possible to know what properties need to be stored and those which don't. However, there is a mechanism for controlling what properties are written to the RichText, namely the ElementWriteToXML and ElementReadFromXML events which are triggered each time a XAML element is encountered in the RichText XML during conversion to XAML and to XML.

The RichTextBoxEventArgs object passed in contains a Source property which contains the instantiated element (Canvas) allowing you to set additional properties during the read process (Converting from RichText to XAML).

During the write process (Converting XAML to RichText) the Parameter property can be set to additional properties, in your example you would set your background property value here.

It's something that may be improved upon in the future, but using this method you have fine control over property getting/setting.

07/30/2008 01:10
 
dan said:

Hi,

Thanks for the comment. There is an issue in the current version which has been fixed in version 4.9 which will be out soon, those interested in BETA testing 4.9 can email us!

07/30/2008 12:43
 
RadiateLogic said:

The RichText property needs to be set or you'll receive this error as soon as an event like MouseOver occurs. Here is the minimum string I've found so far that you can set it with, 1 Style element, 1 Text Element. It is using VB escape syntax for the double quotes so if you use C# you'll need to covert.

07/29/2008 12:16

Silverlight 3

Latest News

  • Silverlight 2 Controls V5.2.1 Released
    Jul, 03 2009

    After several months since the last release we have implemented many fixes to the controls library. The Rich TextBox has been improved with Links...

  • Silverlight 3 BETA Controls Released
    Mar, 30 2009

    As Silverlight 3 BETA is available now to test we thought we would present the Liquid Controls library for Silverlight 3. This BETA...

Silverlight 2 Controls

  • Rich TextBox

    Create and edit rich content with this slick and expandable Rich TextBox...

  • TreeView

    This easy to use TreeView comes with drag and drop, sorting, searching and much more...

  • Context Menu

    You too can have cool popup context menus in your Silverlight applications...

  • Resizable Dialog

    Draggable and resizable popup dialogs are what serious Silverlight developers need...

  • Spell Checker

    Real-time spell checking in Silverlight? We did it first here...