Migrate from RichTextBox to RichTextEditor

3 Answers 94 Views
RichTextEditor
Raj
Top achievements
Rank 1
Iron
Raj asked on 30 May 2023, 08:57 AM | edited on 30 May 2023, 11:22 AM

Hi Team,

We are planning to migrate Telerik.WinControls.RichTextEditor.dll (2023.1.314.40) in visual studio 2022.

We are unable to compile the program and getting an errors like below.

  • The type or namespace name 'RadDocument' could not be found (are you missing a using directive or an assembly reference?)
  • The type or namespace name 'StyleDefinition' could not be found (are you missing a using directive or an assembly reference?)
  • The type or namespace name 'BaselineAlignment' could not be found (are you missing a using directive or an assembly reference?)
  • The type or namespace name 'UnderlineType' could not be found (are you missing a using directive or an assembly reference?)
  • The type or namespace name 'Paragraph' could not be found (are you missing a using directive or an assembly reference?)
  • The type or namespace name 'RadTextAlignment' could not be found (are you missing a using directive or an assembly reference?)
  • The type or namespace name 'ListNumberingFormat' could not be found (are you missing a using directive or an assembly reference?)
  • The type or namespace name 'InsertTableForm' could not be found (are you missing a using directive or an assembly reference?)
  • The type or namespace name 'ListStyle' could not be found (are you missing a using directive or an assembly reference?)
  • The type or namespace name 'RtfFormatProvider' could not be found (are you missing a using directive or an assembly reference?)
  • The type or namespace name 'ITextBasedDocumentFormatProvider' could not be found (are you missing a using directive or an assembly reference?)
  • The type or namespace name 'TxtFormatProvider' could not be found (are you missing a using directive or an assembly reference?)
  • The name 'DefaultListStyles' does not exist in the current context
  • The name 'Span' does not exist in the current context
  • The name 'Unit' does not exist in the current context
  • The name 'TextStyle' does not exist in the current context
  • 'RadRichTextEditor' does not contain a definition for 'DocumentView' and no accessible extension method 'DocumentView' accepting a first argument of type 'RadRichTextEditor' could be found (are you missing a using directive or an assembly reference?)

What is an equivalent namespaces for following references? Could you please help on this below?

  • using Telerik.WinControls.RichTextBox;
  • using Telerik.WinControls.RichTextBox.FileFormats.Rtf;
  • using Telerik.WinControls.RichTextBox.Layout;
  • using Telerik.WinControls.RichTextBox.Lists;
  • using Telerik.WinControls.RichTextBox.Model;
  • using Telerik.WinControls.RichTextBox.Model.Styles;
  • using Telerik.WinControls.RichTextBox.UI;
  • using Telerik.WinControls.RichTextBox.FormatProviders;
  • using Telerik.WinControls.RichTextBox.FormatProviders.Txt;

Note: Its working fine in the Telerik.WinControls.RichTextBox.dll (2013.3.1127.40)

example program:

private void InitializeCurrentFontStyles(StyleDefinition styleDefinition) { try { UnderlineType underlineType = (UnderlineType)styleDefinition.GetPropertyValue(Span.UnderlineTypeProperty); this.radBtnUnderlineStyle.ToggleState = underlineType != UnderlineType.None ? ToggleState.On : ToggleState.Off; string fontFamiliy = (string)styleDefinition.GetPropertyValue(Span.FontFamilyProperty); this.radDropDownListFont1.SuspendSelectionEvents = true; this.radDropDownListFont1.Text = fontFamiliy; this.radDropDownListFont1.SelectedValue = fontFamiliy; this.radDropDownListFont1.SuspendSelectionEvents = false; float fontSize = (float)styleDefinition.GetPropertyValue(Span.FontSizeProperty); fontSize = (float)Math.Round(Unit.DipToPoint(fontSize), 1); this.EnsureFontSize(fontSize.ToString()); TextStyle fontStyle = (TextStyle)styleDefinition.GetPropertyValue(Span.FontStyleProperty); this.radBtnBoldStyle.ToggleState = fontStyle.HasFlag(TextStyle.Bold) ? ToggleState.On : ToggleState.Off; this.radBtnItalicStyle.ToggleState = fontStyle.HasFlag(TextStyle.Italic) ? ToggleState.On : ToggleState.Off; } catch (Exception ex) { RadMessageBox.SetThemeName("Office2007Silver"); RadMessageBox.Show(ex.Message, res_man.GetString("ProposalEntityMaster", PNxt_BL.Common.CultureInfo), MessageBoxButtons.OK, RadMessageIcon.Error); } using (InsertTableForm insertForm = new InsertTableForm()) { insertForm.Owner = this; insertForm.ThemeName = "Office2007Silver"; if (insertForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.radRichTextBox1.InsertTable(insertForm.RowsCount, insertForm.ColumnsCount); } } this.radRichTextBox1.DocumentView.Caret.Hide(); }


Thanks,

Rajkannan


3 Answers, 1 is accepted

Sort by
1
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 31 May 2023, 12:15 PM

Hi, Raj,

I am glad that you made some progress in the migration process to RadRichTextEditor. As to the question about the DocumentView and hiding the caret, it is possible to use the following approach:

        private void RadRichTextEditor1_GotFocus(object sender, EventArgs e)
        {
            this.radRichTextEditor1.RichTextBoxElement.ActiveEditorPresenter.HideCaret();
        }

The ActiveEditorPresenter also offers ShowCaret method.

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Raj
Top achievements
Rank 1
Iron
commented on 01 Jun 2023, 03:03 AM | edited

Hi Dess,

It works fine now. Thankyou for your quick response. 

 

Thanks

Rajkannan

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 May 2023, 01:32 PM

Hello, Raj,

As you have already found out RadRichTextBox has been replaced by RadRichTextEditor. Please refer to the following help article demonstrating how to upgrade: Upgrading to RadRichTextEditor

You can get the answers for some of the frequently asked questions about the use of RadRichTextEditor here: 

https://docs.telerik.com/devtools/winforms/controls/richtexteditor/frequently-asked-questions 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Raj
Top achievements
Rank 1
Iron
commented on 31 May 2023, 04:43 AM

Hi Dess,

Thanks for your reply. It works for me.

We have one more clarification on the below code, could you please help on this?

When compile the code it gives an error below,

RadRichTextEditor' does not contain a definition for 'DocumentView' and no accessible extension method 'DocumentView' accepting a first argument of type 'RadRichTextEditor' could be found (are you missing a using directive or an assembly reference?)

private void BtnAddNew_Click(object sender, EventArgs e)
{
       this.radRichTextBox1.DocumentView.Caret.Hide();
}

 void radRichTextBox1_GotFocus(object sender, System.EventArgs e)
{
       this.radRichTextBox1.DocumentView.Caret.Show();
}

Thanks

Rajkannan

0
Raj
Top achievements
Rank 1
Iron
answered on 31 May 2023, 05:09 AM | edited on 31 May 2023, 10:15 AM

Hi Dess,

Thanks for your reply. It works for me.

We have one more clarification on the below code,  How to hide/show 'Documentview Caret' using RadRichTextEditor? could you please help on this?

When compile the code it gives an error below,

'RadRichTextEditor' does not contain a definition for 'DocumentView' and no accessible extension method 'DocumentView' accepting a first argument of type 'RadRichTextEditor' could be found (are you missing a using directive or an assembly reference?)

private void BtnAddNew_Click(object sender, EventArgs e)
{
       this.radRichTextBox1.DocumentView.Caret.Hide();
}

 void radRichTextBox1_GotFocus(object sender, System.EventArgs e)
{
       this.radRichTextBox1.DocumentView.Caret.Show();
}

Thanks

Rajkannan

Tags
RichTextEditor
Asked by
Raj
Top achievements
Rank 1
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Raj
Top achievements
Rank 1
Iron
Share this question
or