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();
}
}
}