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

RichTextBox performance on first time

3 Answers 245 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Antony
Top achievements
Rank 1
Antony asked on 06 Mar 2017, 06:06 AM

 Hi Team,

We developing application with Prism and we need to edit the content at run time. So we used empty RadRichTextBox along with RadToolBar, we wont use any document. But it hits the performance on first time, please refer the below code.

 

<telerik:RadToolBarTray DataContext="{Binding ElementName=editor, Path=Commands}" telerik:StyleManager.Theme="Windows8" Background="LightGray" IsLocked="True">
<telerik:RadToolBarTray.Resources>
    <telerik:FontFamiliesProvider x:Key="FontFamiliesProvider" />
</telerik:RadToolBarTray.Resources>
 
<telerik:RadToolBar Height="32" OverflowButtonVisibility="Hidden" >
    <telerik:RadButtonGroup>
        <telerik:RadRibbonButton CollapseToSmall="WhenGroupIsMedium" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding CutCommand}" Size="Medium" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/cut.png"  />
        <telerik:RadRibbonButton CollapseToSmall="WhenGroupIsMedium" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding CopyCommand}" Size="Medium" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/copy.png" />
        <telerik:RadRibbonButton CollapseToSmall="WhenGroupIsMedium" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding PasteCommand}" Size="Medium" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/paste.png" />
    </telerik:RadButtonGroup>
    <telerik:RadToolBarSeparator />
    <telerik:RadButtonGroup>
        <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding UndoCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/undo.png" Text="Undo" />
        <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding RedoCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/redo.png" Text="Redo" />
    </telerik:RadButtonGroup>
    <telerik:RadToolBarSeparator />
    <telerik:RadButtonGroup>
        <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleBoldCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/bold.png" />
        <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleItalicCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/italic.png" />
        <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleUnderlineCommand}" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/underline.png" />
        <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleStrikethroughCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/Strikethrough16.png" />
    </telerik:RadButtonGroup>
    <telerik:RadButtonGroup>
        <telerik:RadRibbonToggleButton CommandParameter="Left" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ChangeTextAlignmentCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/alignleft.png" Text="Align Left" />
        <telerik:RadRibbonToggleButton CommandParameter="Center" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ChangeTextAlignmentCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/aligncenter.png" Text="Center" />
        <telerik:RadRibbonToggleButton CommandParameter="Right" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ChangeTextAlignmentCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/alignright.png" Text="Align Right" />
        <telerik:RadRibbonToggleButton CommandParameter="Justify" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ChangeTextAlignmentCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/alignjustify.png" Text="Justify" />
    </telerik:RadButtonGroup>
    <telerik:RadToolBarSeparator />
    <telerik:RadButtonGroup>
        <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding DecrementParagraphLeftIndentCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/outdent.png" />
        <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding IncrementParagraphLeftIndentCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/indent.png" />
    </telerik:RadButtonGroup>
    <telerik:RadToolBarSeparator />
    <telerik:RadButtonGroup>
        <telerik:RadRibbonComboBox CanAutocompleteSelectItems="False" CanKeyboardNavigationSelectItems="False" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=SelectedValue}" Height="21" IsReadOnly="True" ItemsSource="{Binding Source={StaticResource FontFamiliesProvider}, Path=RegisteredFonts}" OpenDropDownOnFocus="True" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeFontFamilyCommand}" telerik:ScreenTip.Description="Change the font family." telerik:ScreenTip.Title="Font" Width="132" />
        <telerik:RadRibbonComboBox CanAutocompleteSelectItems="False" CanKeyboardNavigationSelectItems="False" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.Tag}" Height="21" IsEditable="True" IsReadOnly="True" IsTextSearchEnabled="False" OpenDropDownOnFocus="True" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeFontSizeCommand}" Width="45">
            <telerik:RadRibbonComboBoxItem Content="8" Tag="10.67" />
            <telerik:RadRibbonComboBoxItem Content="9" Tag="12" />
            <telerik:RadRibbonComboBoxItem Content="10" Tag="13.33" />
            <telerik:RadRibbonComboBoxItem Content="11" Tag="14.67" />
            <telerik:RadRibbonComboBoxItem Content="12" Tag="16" />
            <telerik:RadRibbonComboBoxItem Content="14" Tag="18.67" />
            <telerik:RadRibbonComboBoxItem Content="16" Tag="21.33" />
            <telerik:RadRibbonComboBoxItem Content="18" Tag="24" />
            <telerik:RadRibbonComboBoxItem Content="20" Tag="26.67" />
            <telerik:RadRibbonComboBoxItem Content="22" Tag="29.33" />
            <telerik:RadRibbonComboBoxItem Content="24" Tag="32" />
            <telerik:RadRibbonComboBoxItem Content="26" Tag="34.67" />
            <telerik:RadRibbonComboBoxItem Content="28" Tag="37.33" />
            <telerik:RadRibbonComboBoxItem Content="36" Tag="48" />
            <telerik:RadRibbonComboBoxItem Content="48" Tag="64" />
            <telerik:RadRibbonComboBoxItem Content="72" Tag="96" />
        </telerik:RadRibbonComboBox>
    </telerik:RadButtonGroup>
    <telerik:RadButtonGroup>
        <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ToggleBulletsCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/list-bullets.png" />
        <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ToggleNumberedCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/list-numbered.png" />
        <telerik:RadRibbonDropDownButton Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/MultilevelList.png">
            <telerik:RadRibbonDropDownButton.DropDownContent>
                <StackPanel>
                    <telerik:RadGroupHeader Content="List Library" />
                    <telerik:RadGallery ItemHeight="88" ItemWidth="88" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ChangeListStyleCommand}" ViewportHeight="176" ViewportWidth="266">
                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListNone.png" Tag="None" />
                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListBulleted.png" Tag="Bulleted" />
                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListNumbered.png" Tag="Numbered" />
                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListNumberedParenthesis.png" Tag="NumberedParenthesis" />
                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListNumberedHierarchical.png" Tag="NumberedHierarchical" />
                    </telerik:RadGallery>
                </StackPanel>
            </telerik:RadRibbonDropDownButton.DropDownContent>
        </telerik:RadRibbonDropDownButton>
    </telerik:RadButtonGroup>
</telerik:RadToolBar>
</telerik:RadToolBarTray>
 
<telerik:RadRichTextBox  Name="editor"
                        telerik:StyleManager.Theme="Windows8"
                        Grid.Row="1"
                        Margin="0"
                        FocusVisualStyle="{x:Null}"
                        EnforcedPermissionRangeBrush="Blue"
                        Background="{x:Null}" />

 

And we have tried all possible ways that you have described in below link.

http://docs.telerik.com/devtools/wpf/controls/radrichtextbox/mef#initial-load-performance-of-radrichtextbox

Please refer the below code. 

RadCompositionInitializer.Catalog = new TypeCatalog();
DocumentFormatProvidersManager.AutomaticallyLoadFormatProviders = false;
InitializeComponent();
this.editor.UILayersBuilder = new UILayersBuilder();

 

 

While using the above code the loading time is reduced, but not completely. Still it takes minimum five seconds to load at first time. Please suggest any ideas to reduce the loading time completely.

 

Thanks,

Antony

3 Answers, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 08 Mar 2017, 04:34 PM
Hello Antony,

All the tips for improving the initial loading performance of RadRichTextBox are described in the article you mentioned and I am afraid that there isn't much I can suggest decrease the time required for the control to load more. What you should have in mind when using these tips is that they are applicable for versions after Q3 2015 and if you are using an older one, probably you are not observing their full impact.

I tested your code and the window containing RadRichTextBox with RadToolBarTray is loaded for ~1.3 seconds when loading for the first time and less than a half of the second for the next calls. You can try to profile your application to check whether there could be something that can slow down the performance. An example for a profiling tool is JustTrace.

Regards,
Tanya
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
Antony
Top achievements
Rank 1
answered on 14 Mar 2017, 04:33 PM

Hi Tanya, 

I haves checked with JustTrace and found that the call is not related to telerik. But it is working fine when there is RichTextBox and RadToolBarTray. Is there any way to reduce that two seconds which is denoted by you.

And I have tried with simple sample which had button to show the RichTextBox and RichToolBar in new ChildWindow, its also takes some time where more than two seconds to load. 

Regards,

Antony Raj

 

0
Tanya
Telerik team
answered on 17 Mar 2017, 03:32 PM
Hi Antony,

The time necessary for RadRichTextBox to load may vary depending on the machine's parameters. The control comes with many built-in features, which inevitably affect the performance when loading and using the discussed settings is the most optimal solution I can suggest you at this point. 

Regards,
Tanya
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
RichTextBox
Asked by
Antony
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Antony
Top achievements
Rank 1
Share this question
or