RichTextBox Cutting off the end of characters

15 posts, 0 answers
  1. Kevin
    Kevin avatar
    83 posts
    Member since:
    Sep 2008

    Posted 10 May 2011 Link to this post

    Guys,

    I'm having issue with my RichTextBox and some funky UI stuff, Its cutting off my Characters (see Link at the bottom of this post) And also the Cursor in this instance appears to be BEFORE the H, but is actually at the end of the H...

    <telerik:RadRichTextBox FontFamily="Arial" FontSize="9" DocumentInheritsDefaultStyleSettings="True" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" />

    http://www.flickr.com/photos/57960866@N06/5707505816/in/photostream
    Any help would be appreciated.
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 12 May 2011 Link to this post

    Hi kevin,

    Thank you for getting to us about the strange behavior you are observing.
    The misplaced caret is a bug related to the specific font and size, which we will look into and hopefully, fix, for the next release.
    As for the cutting of the last character, do you, by any chance, have a default style for all TextBlocks in your application? RadRichTextBox uses TextBlocks internally and they might be taking over this style. We will prevent that on our end in the next release, too, but as a workaround, you can set a style in the resources of the RichTextBox:

    <telerik:RadRichTextBox FontFamily="Arial" FontSize="9" DocumentInheritsDefaultStyleSettings="True">
        <telerik:RadRichTextBox.Resources>
            <Style TargetType="TextBlock" />
        </telerik:RadRichTextBox.Resources>
    </telerik:RadRichTextBox>

    I hope that helps.


    All the best,
    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Couchetard
    Couchetard avatar
    2 posts
    Member since:
    Oct 2011

    Posted 06 Dec 2011 Link to this post

    Hi,

    I'm using a control that has a RadRichTextBox inside, when displayed, the end of the texte in the document is cut off (as if it is hidden under the vertical scrollbar space). Do you have any clue?

     

     


    <
    Telerik:RadRichTextBox DocumentInheritsDefaultStyleSettings="True"

     

     

    x:Name="ctlRadRichTextBox"

     

     

    DockPanel.Dock="Bottom"

     

     

    IsContextMenuEnabled="False"

     

     

    IsSpellCheckingEnabled="False"

     

     

    IsSelectionMiniToolBarEnabled="False"

     

     

    VerticalScrollBarVisibility="Auto"

     

     

    DocumentContentChanged="RadRichTextBox_DocumentContentChanged"

     

     

     

    PS: The document content is binded in RTF format.

  5. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 09 Dec 2011 Link to this post

    Hi Couchetard,

    I couldn't reproduce the problem you have described. Can you please provide us with a simple project illustrating the problem attached to a support ticket.
    Before that you could check if everything is ok with the following attributes if you are using them: width, margin and padding inside your user control, because the RadRichTextBox is a bit wider than the other containers.
    We would also appreciate it if you also specified which version of the controls you are using, e.g. 2011.3.1116.40.

    Greetings,
    Mihail
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Vishnu
    Vishnu avatar
    5 posts
    Member since:
    Sep 2013

    Posted 13 Sep 2013 Link to this post

    Hi,

    I am using RadRichTextBox control for preview in WPF.  Whena Date text is  italicized, the last character is getting cut off but when the change the font style back to normal, i see the complete date...


    How to control this behaviour


    Thanks
    Vishnu
  7. Petya
    Admin
    Petya avatar
    975 posts

    Posted 18 Sep 2013 Link to this post

    Hello Vishnu,

    We are unaware of any similar issues and I could not replicate this. Would you mind sharing some additional details such as:
    • Are you able to replicate the problem in our click-once examples and what steps are you executing?
    • What exactly is the setup of your project?
    • What type of document is shown when the issue is observed?
    Any other details you feel are relevant will also be appreciated. 

    I'm looking forward to your reply.

    Regards,
    Petya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  8. Vishnu
    Vishnu avatar
    5 posts
    Member since:
    Sep 2013

    Posted 18 Sep 2013 Link to this post

    Here is my control
       <telerik:RadRichTextBox Grid.Row="2" IsReadOnly="True" x:Name="rtbHtmlTestRad" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" />

    i do have combo boxes for user to select Font Style/Font weight/Font/size. The text in the preview is displayed completely for specific values of Font Style/Font weight/Font/size (example : Font Style = Normal, Font Size= 12 points Font family = Times New Roman, but if i change the Font Style = Italic, Font Size = 10, the last text character is getting cut off). So the issue is specific values of Font Size.....

    Note:1) I am constructing the text programatically using RadDocument/Rad Span for displaying text. The Font settings are then applied to RadSpan, which are then added to Paragraphs. Different text in the document has different Font settings like Heading in bold, dates in Italic, body in Normal

    2) The cutoff issue is also observed for regular text when changed to bold and increased Font Size

    • Are you able to replicate the problem in our click-once examples and what steps are you executing?
      No (For steps please see the first paragraph)
    • What exactly is the setup of your project?
         WPF project using Telerik controls
    • What type of document is shown when the issue is observed?
      RadDocument


    Thanks
    Vishnu
  9. Petya
    Admin
    Petya avatar
    975 posts

    Posted 23 Sep 2013 Link to this post

    Hi Vishnu,

    Unfortunately, I am still unable to reproduce the behavior you are observing. Please try to provide us with a sample project which demonstrates the problem and we will do our best to address it.

    Thank you for your cooperation!

    Regards,
    Petya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  10. Sandra
    Sandra avatar
    16 posts
    Member since:
    Sep 2011

    Posted 30 Oct 2013 Link to this post

    I have attached three screenshots demonstrating the effects of the issue and will be posting sample code later today. 

    In the screenshots you can see the formatting differences between Normal, Bold, and Bold Italic for 18pt Times New Roman. Other font families and other font sizes also exhibit this behavior but these are illustrative. This issue presents for Italic without Bold as well but showing the Bold Italic highlights the issue nicely.

    In each screenshot I have highlighted the same sections of text for visual reference.

    What you see in the Normal selection is the text displayed with no cutoff and fills up seven lines almost exactly. In the Bold selection you see that the text is also displaying with no cutoff and fills up a majority of eight lines. The problem is with the Bold Italic.

    First note the words are being cut off in the middle. Also note that the Bold Italic takes up about eight and a third lines (less than Bold but more than Normal). This is similar to how Word behaves - the Bold Italic text takes up less space than the plain Bold text. 

    To describe this is non-code terms I do the following
    1. Create a RadDocument
    2. Add a Section
    3. Add a Paragraph and set the paragraph's font size to 1.25 the value that will be in the text. All of the text in the paragraph will be formatted with the same family, size, and style.
    4. Add a Span and set the family, size, and style and then add the text to it.

    You will also note in the screenshots the "Effective Date" and "Revision Date" are displaying fully. This only happens when I append a non-breaking space (NBSP) to the end of the Italic date. If I do not append the NBSP then the last character of the date is cut off. A plain space character will leave the date cut off as well so a NBSP is required here.

    More coming later today.

    Many thanks!
  11. Sandra
    Sandra avatar
    16 posts
    Member since:
    Sep 2011

    Posted 30 Oct 2013 Link to this post

    I'm making my sample application more and more complex to try and replicate the issue but it still works great on the sample app and still fails in my application.

    I pulled out a utility called "Snoop" (http://snoopwpf.codeplex.com/releases/view/87261) to try and see if there are any differences in the application structure that might be of note. I've attached a screenshot from the sample application (sampleeditingcontext.png) and the main application. You can see the container hierarchy and see that the application hierarchy is significantly more complex than the sample app hierarchy.

    Additionally what these screenshots are showing are the EditingContext for the RadRichTextBox in both applications. To my surprise the context for the sample application has *much* more data. That being said I'm not certain how much the "more" matters. The one thing that does pique my interest though is the context for the application showing the difficulty has a Font Size of 14 where the sample app does not. 

    What does the EditingContext do? How are these properties set? Are they inherited from someone else? Does the Font Size matter in terms of how the text box will render text that is set at 10px instead of 14?

    Help please.


  12. Boby
    Admin
    Boby avatar
    595 posts

    Posted 04 Nov 2013 Link to this post

    Hello Sandra,
    Actually you are observing differences in CurrentEditingStyle property, which value may depend on the caret position and the loaded document.
    Anyway, sometimes problems similar to yours may occur if  a style is implicitly set to TextBlock or some other element which is used internally by the RadRichTextBox for visualizing the content. Could you try to remove all custom styles (especially for TextBlock) in your application? If this is the problem, you may be able to work around it by re-setting the default TextBlock style only in the scope of RadRichTextBox.

    Let us know if this helps.

    Regards,
    Boby
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  13. Sandra
    Sandra avatar
    16 posts
    Member since:
    Sep 2011

    Posted 05 Nov 2013 Link to this post

    In my UserControl.Resources section of my XAML file I added the following:
            <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
            </Style>

    In my RadRichTextBox I set Style="{x:null}" as follows:
                <telerik:RadRichTextBox Grid.Row="4" IsReadOnly="True" x:Name="rtbHtmlTestRad" LayoutMode="Flow" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Margin="0" Padding="10" BorderThickness="1" Style="{x:Null}" >
                    <telerik:RadRichTextBox.BorderBrush>
                        <SolidColorBrush Color="#FFD0D0D0" telerik:Windows8Colors.Color="Basic"/>
                    </telerik:RadRichTextBox.BorderBrush>
                </telerik:RadRichTextBox>

    If the issue is with the TextBlock style is there another (better?) way of setting that?

    rjsjr
  14. Boby
    Admin
    Boby avatar
    595 posts

    Posted 07 Nov 2013 Link to this post

    Hello Sandra,
    Could you specify the version you are using, as in the recent versions RadRichTextBox is not affected from the implicit styles set to TextBlock, which may make my  suggestion irrelevant depending on the version.
    Also ensure that you are not setting any of the properties of the TextOptions class in the scope of RadRichTextBox, as these are not supported by the control.

    If the mentioned suggestions don't help, please try to reproduce the problem in sample application and send it to us in a support ticket for further investigation.

    Regards,
    Boby
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  15. Sandra
    Sandra avatar
    16 posts
    Member since:
    Sep 2011

    Posted 07 Nov 2013 Link to this post

    I'm using 2013.2.0724.40

    I don't think I'm doing anything with TextOptions at all but will look again. 

    I have tried creating a sample project replicating code and layout and the sample project does not show the issue. We're working with some internal resources to try and figure this out and if I can't get it figured out tomorrow I'm going to send it to y'all on Monday. Hopefully your upload facility will take a really big file. If not, we have a corporate facility that I can send you the code with if I have an email address.

    Thanks!

  16. Sandra
    Sandra avatar
    16 posts
    Member since:
    Sep 2011

    Posted 07 Nov 2013 Link to this post

    THANK YOU!!!

    In a (I thought) completely unrelated .xaml file I found
            TextOptions.TextFormattingMode="Display"

    And when I removed that entry the text is now displaying properly.

    THANK YOU! THANK YOU! THANK YOU!
Back to Top
UI for WPF is Visual Studio 2017 Ready