This is a migrated thread and some comments may be shown as answers.

Letters moving to next line in RichTextBox for Silverlight

5 Answers 193 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mike Gold
Top achievements
Rank 1
Mike Gold asked on 18 May 2011, 04:38 AM
Hi,

I'm having strange behavior in the RadRichTextBox and not sure why.  The RadRichTextBox is sometimes moving letters to the next line in the middle of a sentence.  I've attached a picture of what it looks like.  Notice the word Patient, where the t is strangely on the next line of the control.  Any ideas why this may be happening?  This happens across the entire content of my control and it happens when I type in the control.

-Mike

5 Answers, 1 is accepted

Sort by
0
Mike Gold
Top achievements
Rank 1
answered on 19 May 2011, 04:58 AM
Haven't heard any response.  Usually someone sends some response, but perhaps you have no idea what could be happening <g>.   This is happening pretty consistently and I just copied the code out of the sample and pasted it into my user control, but the sample doesn't seem to exhibit the behavior.   Here is another picture of the problem.  The control just spews letters all over the place.
0
Boby
Telerik team
answered on 19 May 2011, 12:21 PM
Hello Mike Gold,
This is most probably caused by setting custom style to TextBlocks, which RadRichTextBox uses internally for visualizing document's content. As a workaround you can set empty style to TextBlocks in control's resources:
<telerik:RadRichTextBox>
    <telerik:RadRichTextBox.Resources>
        <Style TargetType="TextBlock"/>
    </telerik:RadRichTextBox.Resources>
</telerik:RadRichTextBox>

Regards,
Boby
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mike Gold
Top achievements
Rank 1
answered on 19 May 2011, 07:58 PM
Thanks Boby,

That fixed it.  Apparently the theme styles were clobbering your control.  Appreciate the help!!
0
Cyrus
Top achievements
Rank 1
answered on 02 Jun 2011, 09:49 PM
I am having a similar issue, but I am putting the RichTextBox into a popup and then displaying it. I am programmatically creating the popup as it needs to be added to the root of the visual tree. View snippet below:

var popup = new Popup{Name = "HelpPopup"};
            var stackPanel = new StackPanel
                                    {
                                     Orientation = Orientation.Vertical,
                                     Background = new SolidColorBrush(Colors.DarkGray)
                                    };
  
            var richtxt = new RadRichTextBox
                              {
                                  IsReadOnly = true,
                                  VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
                                  IsSpellCheckingEnabled = false,
                                  Height = 375,
                                  Width = 600,
                                  Margin = new Thickness(5d),
                                  Resources = new ResourceDictionary()
                              };
            var s = new Style(typeof (TextBlock));
            richtxt.Resources.Add("TargetType", s);
            richtxt.DocumentInheritsDefaultStyleSettings = true;
  
            var closebtn = new Button {Content = "Ok", Height = 25, Width = 75};
            stackPanel.Children.Add(richtxt);
            stackPanel.Children.Add(closebtn);

I am trying to apply the default style through the code and running into the same issue with text being displayed wherever it feels. Attached is the popup being displayed with sample text. Any help would be appreciated.
0
Iva Toteva
Telerik team
answered on 06 Jun 2011, 02:48 PM
Hello Cyrus,

Thank you for providing a code-snippet illustrating your implementation. The only thing that needs to be changed in order to make it work is to add the style as a default one for TextBlocks rather than naming it. Please refer to the code-snippet below for the modification that needs to be done:

var s = new Style(typeof (TextBlock));
richtxt.Resources.Add(typeof (TextBlock), s);

Best wishes,
Iva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
RichTextBox
Asked by
Mike Gold
Top achievements
Rank 1
Answers by
Mike Gold
Top achievements
Rank 1
Boby
Telerik team
Cyrus
Top achievements
Rank 1
Iva Toteva
Telerik team
Share this question
or