To reproduce: 1.Use the provided xml file in the following article: http://www.telerik.com/help/winforms/richtexteditor-localization.html and change these strings: "Documents_ParagraphPropertiesDialog_TextAlignment_Center": "Mittig"; "Documents_ParagraphPropertiesDialog_TextAlignment_Justify": "Block"; "Documents_ParagraphPropertiesDialog_TextAlignment_Left": "Links"; "Documents_ParagraphPropertiesDialog_TextAlignment_Right": "Rechts"; 2.Afterwards, specify the RichTextBoxLocalizationProvider.CurrentProvider by loading the modified file. 3.Run the application, select some paragraph and try to change its alignment. As a result when the ParagraphPropertiesDialog is opened, incorrect alignment text is displayed in the drop-down. If you select a new value a handled ArgumentException is thrown and the paragraph is not aligned at all. Workaround: use a custom ParagraphPropertiesDialog: public Form1() { RichTextBoxLocalizationProvider.CurrentProvider = RichTextBoxLocalizationProvider.FromFile(@"..\..\RichTextBoxStrings - Copy.xml"); InitializeComponent(); this.radRichTextEditor1.RichTextBoxElement.ParagraphPropertiesDialog = new CustomDialog(); } public partial class CustomDialog : ParagraphPropertiesDialog { public CustomDialog() { InitializeComponent(); FieldInfo fi = typeof(ParagraphPropertiesDialog).GetField("radButtonOK", BindingFlags.Instance | BindingFlags.NonPublic); RadButton btn = fi.GetValue(this) as RadButton; btn.MouseDown += btn_MouseDown; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (selectedItem != null) { ButtonAlignement.Text = selectedItem.Text; } } public RadDropDownButton ButtonAlignement { get { FieldInfo fi = typeof(ParagraphPropertiesDialog).GetField("radDropDownButtonAlignement", BindingFlags.Instance | BindingFlags.NonPublic); RadDropDownButton radDropDownButtonAlignement = fi.GetValue(this) as RadDropDownButton; return radDropDownButtonAlignement; } } RadMenuItem selectedItem = null; RadDropDownButton radDropDownButtonAlignement = null; private void btn_MouseDown(object sender, MouseEventArgs e) { foreach (RadMenuItem item in ButtonAlignement.Items) { if (item.Text == ButtonAlignement.Text) { selectedItem = item; break; } } if (selectedItem != null) { ButtonAlignement.Text = selectedItem.Tag.ToString(); } } }
Currently, the scrollbars width is calculated only according to SystemInformation.VerticalScrollBarWidth. Workaround: class MyRTE : RadRichTextEditor { protected override void CreateChildItems(RadElement parent) { var rte = new MyRTEElement(); typeof(RadRichTextEditor).GetField("richTextBox", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(this, rte); parent.Children.Add(rte); } } public class MyRTEElement : RadRichTextBox { protected override SizeF ArrangeOverride(SizeF finalSize) { base.ArrangeOverride(finalSize); System.Drawing.RectangleF finalRect = new System.Drawing.RectangleF(System.Drawing.PointF.Empty, finalSize); System.Drawing.RectangleF clientRect = finalRect; System.Drawing.RectangleF horizontalScrollRect = System.Drawing.RectangleF.Empty; System.Drawing.RectangleF verticalScrollRect = System.Drawing.RectangleF.Empty; System.Drawing.RectangleF presenterArea = clientRect; if (this.VerticalScrollBar.Visibility != Telerik.WinControls.ElementVisibility.Collapsed) { verticalScrollRect = new System.Drawing.RectangleF( new System.Drawing.PointF(finalRect.Right - this.VerticalScrollBar.Size.Width, finalRect.Top), new System.Drawing.SizeF(this.VerticalScrollBar.Size.Width, finalRect.Height)); } if (this.HorizontalScrollBar.Visibility != Telerik.WinControls.ElementVisibility.Collapsed) { horizontalScrollRect = new System.Drawing.RectangleF( new System.Drawing.PointF(finalRect.Left, finalRect.Bottom - this.HorizontalScrollBar.Size.Height), new System.Drawing.SizeF(finalRect.Width, this.HorizontalScrollBar.Size.Height)); if (this.VerticalScrollBar.Visibility != Telerik.WinControls.ElementVisibility.Collapsed) { horizontalScrollRect.Width -= this.VerticalScrollBar.Size.Width; verticalScrollRect.Height -= this.HorizontalScrollBar.Size.Height; } } presenterArea.Width -= verticalScrollRect.Width; presenterArea.Height -= horizontalScrollRect.Height; if (this.RightToLeft) { horizontalScrollRect = Telerik.WinControls.Layouts.LayoutUtils.RTLTranslateNonRelative(horizontalScrollRect, clientRect); verticalScrollRect = Telerik.WinControls.Layouts.LayoutUtils.RTLTranslateNonRelative(verticalScrollRect, clientRect); presenterArea = Telerik.WinControls.Layouts.LayoutUtils.RTLTranslateNonRelative(presenterArea, clientRect); } this.VerticalScrollBar.Arrange(verticalScrollRect); this.HorizontalScrollBar.Arrange(horizontalScrollRect); var contentPresenter = typeof(RadRichTextBox).GetField("contentPresenter", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(this) as ContentControl; contentPresenter.Arrange(presenterArea); return finalSize; } protected override SizeF MeasureOverride(SizeF availableSize) { base.MeasureOverride(availableSize); System.Drawing.SizeF horizontalScrollSize = System.Drawing.SizeF.Empty; System.Drawing.SizeF verticalScrollSize = System.Drawing.SizeF.Empty; System.Drawing.SizeF presenterSize = availableSize; if (this.VerticalScrollBar.Visibility != Telerik.WinControls.ElementVisibility.Collapsed) { verticalScrollSize = new System.Drawing.SizeF(this.VerticalScrollBar.Size.Width, availableSize.Height); } if (this.HorizontalScrollBar.Visibility != Telerik.WinControls.ElementVisibility.Collapsed) { horizontalScrollSize = new System.Drawing.SizeF(availableSize.Width, this.HorizontalScrollBar.Size.Height); } presenterSize.Width -= verticalScrollSize.Width; presenterSize.Height -= horizontalScrollSize.Height; //presenterSize = base.GetClientRectangle(presenterSize).Size; this.VerticalScrollBar.Measure(verticalScrollSize); this.HorizontalScrollBar.Measure(horizontalScrollSize); var contentPresenter = typeof(RadRichTextBox).GetField("contentPresenter", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(this) as ContentControl; contentPresenter.Measure(presenterSize); return availableSize; } }
The PreviewEditorKeyDown event is not fired when the user is typing in the editor. Workaround Create custom input behaviour: www.telerik.com/help/winforms/richtexteditor-keyboard-support.html
Copy the following image from the browser and paste it to RadRichTextEditor: https://en.wikipedia.org/wiki/File:Telerik_Logo.png. IOException is thrown when pasting the image. However, it is loaded at the end. Export the image with the following code: private void radButton1_Click(object sender, EventArgs e) { DocumentFormatProviderBase provider = new XamlFormatProvider(); byte[] byteData = provider.Export(this.radRichTextEditor1.Document); } ArgumentException occurs. Workaround: save the image first and copy it from Paint for example.
To reproduce: public Form1() { InitializeComponent(); this.radRichTextEditor1.IsReadOnly = true; } Workaround: private void Form1_Load(object sender, EventArgs e) { this.radRichTextEditor1.IsReadOnly = true; Telerik.WinControls.RichTextEditor.UI.DocumentWebLayoutPresenter webLayoutPresenter = this.radRichTextEditor1.RichTextBoxElement.ActiveEditorPresenter as Telerik.WinControls.RichTextEditor.UI.DocumentWebLayoutPresenter; webLayoutPresenter.Caret.Width = 0; }
To reproduce: - Start the demo application - Type some text and try to make it bold with the bold button from the ribbon. Workaround: void richTextEditorRibbonBar1_MouseDown(object sender, MouseEventArgs e) { radRichTextEditor1.RichTextBoxElement.SelectionMiniToolBar.Hide(); }
The LocalizeStrings method of the FloatingBlockPropertiesDialog refers to the "Documents_FindReplaceDialog_ReplaceWith" string. This should be "Documents_FloatingBlockPropertiesDialog_TextWrapping" Workaround: public Form1() { InitializeComponent(); FieldInfo fi = this.radRichTextEditor1.RichTextBoxElement.FloatingBlockPropertiesDialog.GetType().GetField("radPageViewPage2", BindingFlags.NonPublic | BindingFlags.Instance); RadPageViewPage textWrappingPage = (RadPageViewPage)fi.GetValue(this.radRichTextEditor1.RichTextBoxElement.FloatingBlockPropertiesDialog); textWrappingPage.Text = "TextWrapping"; }
To reproduce: use the code snippet below. Please refer to the attached screenshot. public Form1() { RichTextBoxLocalizationProvider.CurrentProvider = new MyRichTextBoxLocalizationProvider(); InitializeComponent(); } public class MyRichTextBoxLocalizationProvider : RichTextBoxLocalizationProvider { public override string GetLocalizedString(string id) { return base.GetLocalizedString(id); } } Workaround: Modify the XML file containing all the strings RichTextBoxLocalizationProvider.CurrentProvider = RichTextBoxLocalizationProvider.FromFile(@"C:\RichTextBoxStrings.xml");. You can download a XML file that contains all the currently used strings from here: http://www.telerik.com/docs/default-source/ui-for-winforms/richtextboxstrings.zip?sfvrsn=2
When the RadRichTExtEditor.Document is rapidly changed not all memory is released Workaround: Point loc = radRichTextEditor1.Location; Size size = radRichTextEditor1.Size; radRichTextEditor1.Dispose(); radRichTextEditor1 = new RadRichTextEditor(); radRichTextEditor1.Location = loc; radRichTextEditor1.Size = size; this.Controls.Add(radRichTextEditor1);
Would it be possible to make the Font Section dropdown editable on the RabRibbonBar? i.e. It would be nice to be able to enter the character "s" for example and see all fonts starting with S. Currently you must scroll. Thanks, Ronny
Workaround use the following code to programatically toggle the spell check mode: RadRibbonBarGroup spellCheckGroup = ((RibbonTab)richTextEditorRibbonBar1.CommandTabs[0]).Items[3] as RadRibbonBarGroup; RadToggleButtonElement toggleButton = spellCheckGroup.Items[1] as RadToggleButtonElement; if (this.radRichTextEditor1.IsSpellCheckingEnabled) { toggleButton.CheckState = CheckState.Unchecked; } else { toggleButton.CheckState = CheckState.Checked; }
Due to a namespace conflict, projects which reference Telerik.WinControls.RichTextBox.dll and target .NET 4.5 or above, cannot be built successfully if they are using some of the conflicting types. The conflict comes from the ICommand interface (https://msdn.microsoft.com/en-us/library/system.windows.input.icommand%28v=vs.110%29.aspx) which was moved from PresentationCore.dll to System.dll in .NET 4.5.
The "Style" gallery is reinitialized each time the AssociatedRichTextEditor is changed.
To reproduce: Import the following rtf: string rtfText = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Tahoma;}{\f2\fnil\fcharset0 Times New Roman;}{\f3\fnil\fcharset0 Arial Unicode MS;}{\f4\fnil\fcharset0 Calibri;}} {\colortbl ;\red0\green0\blue0;} \viewkind4\uc1\pard\tx300\tx600\tx900\tx1200\tx1500\tx1800\tx2100\tx2400\tx2700\tx3000\tx3300\tx3600\tx3900\tx4200\tx4500\cf1\b\fs32 Arial\f1\par Tahoma\par \f2 Times New Roman\par \f0 Arial\f2\par \f3 Arial Unicode MS\par \f4 Calibri\b0\f0\fs20\par }"; RtfFormatProvider rtf = new RtfFormatProvider(); this.radRichTextEditor1.Document = rtf.Import(rtfText); this.richTextBox1.Rtf = rtfText;
If you insert an InlineUIContainer with a RadTextBoxElement, you should be able to export its content when exporting the whole document.
To reproduce: - Add some text so the scrollbars appear. - Scroll up and down with the mouse wheel. - When you scroll to the bottom you will notice that there is extra space after the document end. Workaround: http://www.telerik.com/forums/backspace-key-does-not-properly-invalidate-editor#sP5qkJX4b0S8jwZ3MUGTmQ
To reproduce: - Add several RadRichTextEditors to a form. - Change the icon of the FontPropertiesDialog. - Close the form and force the garbage collector. Workaround: protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); foreach (var item in this.Controls) { var rte = item as RadRichTextEditor; if (rte != null) { ((FontPropertiesDialog)rte.RichTextBoxElement.FontPropertiesDialog).Dispose(); } } }
To reproduce: - Add RichTextEditorRibbonBar to a form and open it upon button click several times. - You will notice that the memory is constantly increasing. Workaround: protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } FieldInfo f1 = this.richTextEditorRibbonBar1.GetType().GetField("tabTableStyle", BindingFlags.NonPublic| BindingFlags.Instance); RichTextEditorRibbonTab tab1 = f1.GetValue(richTextEditorRibbonBar1) as RichTextEditorRibbonTab; tab1.Dispose(); FieldInfo f2 = this.richTextEditorRibbonBar1.GetType().GetField("tabTableLayout", BindingFlags.NonPublic | BindingFlags.Instance); RichTextEditorRibbonTab tab2 = f2.GetValue(richTextEditorRibbonBar1) as RichTextEditorRibbonTab; tab2.Dispose(); FieldInfo f3 = this.richTextEditorRibbonBar1.GetType().GetField("tabHeaderFooter", BindingFlags.NonPublic | BindingFlags.Instance); RichTextEditorRibbonTab tab3 = f3.GetValue(richTextEditorRibbonBar1) as RichTextEditorRibbonTab; tab3.Dispose(); base.Dispose(disposing); }