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

Visual error

4 Answers 60 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Trude
Top achievements
Rank 2
Trude asked on 28 Jun 2010, 09:55 AM
I'm using the Q2 beta controls and I have pretty much followed the MS Word sample posted on this forum:

    Private Sub document_editor_Loaded(ByVal sender As ObjectByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded  
 
        RTB_ruler.AssociatedRichTextBox = RTB  
        SetupNewDocument(RTB.Document)  
 
    End Sub 
 
    Private Sub SetupNewDocument(ByVal _doc As RadDocument)  
 
        _doc.LayoutMode = DocumentLayoutModes.Paged  
        _doc.ParagraphDefaultSpacingAfter = 10  
        _doc.ParagraphDefaultSpacingBefore = 0  
        _doc.PageViewMargin = New SizeF(6, 6)  
        _doc.SectionDefaultPageMargin = New Padding(95)  
 
    End Sub 

I'm facing two issues and both can be seen in the attached screenshot

1. When the editor is first loaded with the above code - the cursor is placed up in the left corner outside the white area. When I start typing the cursor jumps inside the white area and everything looks normal.
2. There are no arrows on the rulers - they are simply gone.

4 Answers, 1 is accepted

Sort by
0
Trude
Top achievements
Rank 2
answered on 28 Jun 2010, 10:28 AM
A little update:

If I place the mouse over the text cursor and drag to the left I get a System.NullReferenceException and the application crashes

If I add the following line of code or import a document everything seems normal (the ruler arrows are missing, though)

 

 

RTB.Document.InsertAtCaretPosition("abc", RTB.Document.GetSpanAtCaretPosition)

 

0
Trude
Top achievements
Rank 2
answered on 29 Jun 2010, 11:44 PM
Any updates on this? It seems like the default document (when the richtextbox is first opened) contains a null reference. As for the missing arrows on the rulers? Maybe I'm missing a property where I can set the arrow images?
0
Alex
Telerik team
answered on 30 Jun 2010, 09:12 AM
Hi Jorn,

 Thanks for reporting these issues. We will do our best to fix them for the official release.
There is a temporary workaround for the missing arrows on the ruler. You can manually change the templates for the thumbs after the ruler is loaded. Here is the ruler definition in XAML:

<telerikRuler:RulerControl x:Name="editorRuler" Grid.Row="1" Loaded="editorRuler_Loaded" >
  <telerikRuler:RulerControl.Resources>
    <ControlTemplate TargetType="Thumb"  x:Key="IndentThumbTemplate">
      <Image Source="/[name_of_your_assembly];component/Images/RichTextBox/Ruler/thumb-down.png" Width="9" Height="8" />
    </ControlTemplate>
  </telerikRuler:RulerControl.Resources>
</telerikRuler:RulerControl>

And this is the code for the loaded event where the templates for the thumbs are changed manually:

private void editorRuler_Loaded(object sender, RoutedEventArgs e)
{
    ControlTemplate thumbTemplate = (ControlTemplate)this.editorRuler.Resources["IndentThumbTemplate"];
    ((Thumb)this.editorRuler.FindName("RightParagraphIndentThumb")).Template = thumbTemplate;
    ((Thumb)this.editorRuler.FindName("LeftParagraphIndentThumb")).Template = thumbTemplate;
}

I hope this fix this issue until the official release.

Greetings,
Alex
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
Trude
Top achievements
Rank 2
answered on 02 Jul 2010, 07:22 PM
I worked around the caret/cursor issue by loading an empty xaml document when the editor opens. I can live without the arrows until the Q2 release. Thanks for the feedback!
Tags
RichTextBox
Asked by
Trude
Top achievements
Rank 2
Answers by
Trude
Top achievements
Rank 2
Alex
Telerik team
Share this question
or