Current behavior: With decimal places = 2 2.225 is round to 2.22 the proper behavior would be 2.225 to be round to 2.23
RadAutoCompleteBox - Items collection ordered by input, not alphabetically
IF you canceling the textChanging event of the RadTextBox (e.Cancel = true) the cursor back at the start of the text.
Work around:
1. Create custom text box element that inherited the RadTextBoxElement. For example:
public class MyTextBoxElement : RadTextBoxElement
{
private bool isValueChanging = false;
private int selectionStart = -1;
public MyTextBoxElement()
{
this.TextBoxItem.HostedControl.TextChanged += new EventHandler(HostedControl_TextChanged);
}
protected override void OnTextChanging(Telerik.WinControls.TextChangingEventArgs e)
{
base.OnTextChanging(e);
Regex regEx = new Regex(@"[\s]{1,}");
if (regEx.IsMatch(e.NewValue))
{
isValueChanging = true;
this.selectionStart = base.TextBoxItem.SelectionStart - 1;
}
}
private void HostedControl_TextChanged(object sender, EventArgs e)
{
if (this.isValueChanging && selectionStart >= 0)
{
this.isValueChanging = false;
this.TextBoxItem.SelectionStart = this.selectionStart;
}
}
protected override Type ThemeEffectiveType
{
get
{
return typeof(RadTextBoxElement);
}
}
}
2. Create custom Text box that inherited the RadTextBox: For Example:
public class MyTextBox : RadTextBox
{
private static readonly FieldInfo TextBoxElementFieldInfo = typeof(RadTextBox).GetField("textBoxElement", BindingFlags.NonPublic | BindingFlags.Instance);
public MyTextBox()
{
this.ThemeClassName = typeof(RadTextBox).FullName;
}
protected RadTextBoxElement TextBox
{
get { return (RadTextBoxElement)TextBoxElementFieldInfo.GetValue(this); }
set { TextBoxElementFieldInfo.SetValue(this, value); }
}
protected override void InitializeTextElement()
{
this.TextBox = new MyTextBoxElement();
this.TextBox.StretchVertically = true;
this.TextBox.ShowBorder = true;
}
}
3. Use your custom Text box instead the default RadTextBox.
4. Subscribe to text Changing event of the custom text box and add the following code snippet:
Regex regEx = new Regex(@"[\s]{1,}");
if (regEx.IsMatch(e.NewValue))
{
e.Cancel = true;
}
RadMaskEditBox - does not work correctly when the whole text is selected and user presses key "Enter". Control removes the last character.
Workaround:
Public Class Form1
Dim text1 As String
Dim text2 As String
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyData = Keys.Enter Then
SendKeys.Send("{TAB}")
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.RadMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Standard
Me.RadMaskedEditBox2.MaskType = Telerik.WinControls.UI.MaskType.Standard
Me.RadMaskedEditBox1.Mask = "00/00/00"
Me.RadMaskedEditBox1.Text = "__/__/__"
Me.RadMaskedEditBox2.Mask = "00/00/00"
Me.RadMaskedEditBox2.Text = "__/__/__"
End Sub
Private Sub RadMaskedEditBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadMaskedEditBox1.GotFocus
RadMaskedEditBox1.SelectAll()
text1 = Me.RadMaskedEditBox1.Text
End Sub
Private Sub RadMaskedEditBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadMaskedEditBox1.LostFocus
Me.RadMaskedEditBox1.Text = text1
End Sub
Private Sub RadMaskedEditBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles RadMaskedEditBox1.KeyDown
If e.KeyData = Keys.Enter Then
text1 = Me.RadMaskedEditBox1.Text
End If
End Sub
Private Sub RadMaskedEditBox2_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadMaskedEditBox2.GotFocus
RadMaskedEditBox2.SelectAll()
text2 = Me.RadMaskedEditBox2.Text
End Sub
Private Sub RadMaskedEditBox2_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadMaskedEditBox2.LostFocus
Me.RadMaskedEditBox2.Text = text2
End Sub
Private Sub RadMaskedEditBox2_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles RadMaskedEditBox2.KeyDown
If e.KeyData = Keys.Enter Then
text2 = Me.RadMaskedEditBox2.Text
End If
End Sub
End Class
RadMaskedEditBox - has incorrect behavior when decimal separator is "D". You can set only one digit before separator.
RadSpellCheckerLocalizationProvider - The word dictionary is misspelled in case RadSpellCheckerStringId.NotInDictionary. Workaround: Create custom localization provider and override incorrect string.
To reproduce: -wire to the PreviewKeyDown event like this: radMaskedEditBox1.PreviewKeyDown += radMaskedEditBox1_PreviewKeyDown Workaround: -wire to the TextBoxItem PreviewKeyDown: radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.PreviewKeyDown += TextBoxItem_PreviewKeyDown;
To reproduce:
- Add a blank mask to a form and set its Mask type to Standard.
- Set its mask to "###-##-##";
- Set its PromptChar to a single space.
- Now set the caret before the '-' and type a two digits (the first digit is overridden by the second because the caret is not moved properly).
Workaround:
Subscribe to the following KeyDown event:
void box1_KeyDown(object sender, KeyEventArgs e)
{
int caretPos = this.box1.MaskedEditBoxElement.TextBoxItem.SelectionStart;
if ((e.KeyCode != Keys.Left && e.KeyCode != Keys.Right) && (e.KeyCode != Keys.Up && e.KeyCode != Keys.Down))
{
if (caretPos < box1.Text.Length && box1.Text[caretPos] == '-')
{
this.box1.MaskedEditBoxElement.TextBoxItem.SelectionStart++;
}
}
}
Add the ability to gain focus and change the toggle state upon keypress. Add the ability to show the calendar with a key combination like Alt + DownArrow.
To reproduce:
- Set the NullableValue property to null.
- When you start the application there is no date in datetime picker but when the control loses the focus the date is automatically filled.
Workaround:
- Set the NullDate to equals the Value: radDateTimePicker1.NullDate = radDateTimePicker1.Value;
- Then you change the NullDate in the ValueChanged event:
void radDateTimePicker1_ValueChanged(object sender, EventArgs e) { radDateTimePicker1.NullDate = new DateTime(1980, 1, 1); }
To reproduce:
Add a RadSpinEditor and set its Hexadecimal property to true. Set its maximum to 0xFFFFFFFF(4294967295). Try to enter value larger than 7FFFFFFF(Int.MaxValue). You will notice that the value cannot be set.
Workaround:
public class MySpinEditor : RadSpinEditor
{
public new MySpinElement SpinElement
{
get
{
return base.SpinElement as MySpinElement;
}
private set
{
typeof(RadSpinEditor).GetField("spinElement", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(this, value);
}
}
protected override void CreateChildItems(RadElement parent)
{
this.SpinElement = new MySpinElement();
this.SpinElement.RightToLeft = this.RightToLeft == System.Windows.Forms.RightToLeft.Yes;
this.RootElement.Children.Add(this.SpinElement);
this.SpinElement.ValueChanging += SpinElement_ValueChanging;
this.SpinElement.ValueChanged += SpinElement_ValueChanged;
this.SpinElement.TextChanging += SpinElement_TextChanging;
this.SpinElement.KeyDown += SpinElement_KeyDown;
this.SpinElement.KeyPress += SpinElement_KeyPress;
this.SpinElement.KeyUp += SpinElement_KeyUp;
}
void SpinElement_KeyUp(object sender, KeyEventArgs e)
{
this.CallBaseOnKeyUp(e);
}
void SpinElement_KeyPress(object sender, KeyPressEventArgs e)
{
this.CallBaseOnKeyPress(e);
}
void SpinElement_KeyDown(object sender, KeyEventArgs e)
{
this.CallBaseOnKeyDown(e);
}
void SpinElement_TextChanging(object sender, TextChangingEventArgs e)
{
this.OnTextChanged(e);
}
void SpinElement_ValueChanged(object sender, EventArgs e)
{
this.OnValueChanged(e);
}
void SpinElement_ValueChanging(object sender, ValueChangingEventArgs e)
{
this.OnValueChanging(e);
}
}
public class MySpinElement : RadSpinElement
{
protected override decimal GetValueFromText()
{
try
{
if (!string.IsNullOrEmpty(this.Text) && ((this.Text.Length != 1) || (this.Text != "-")))
{
decimal resultValue = 0m;
if (this.Hexadecimal)
{
resultValue = this.Constrain(Convert.ToDecimal(Convert.ToInt64(this.Text, 16)));
}
else
{
resultValue = this.Constrain(decimal.Parse(this.Text, CultureInfo.CurrentCulture));
}
return resultValue;
}
else
{
return this.internalValue;
}
}
catch
{
return this.internalValue;
}
}
protected override Type ThemeEffectiveType
{
get
{
return typeof(RadSpinElement);
}
}
}
To reproduce:
Add a RadTextBoxControl to a form, insert a text using the following line:
this.radTextBoxControl1.AppendText(string.Format("{0} Foo {0} bar {0}", Environment.NewLine));
You will notice that the newlines are not taken into consideration
Workaround:
Use the following classes -
public class MyTextBoxControl : RadTextBoxControl
{
protected override RadTextBoxControlElement CreateTextBoxElement()
{
return new MyTextBoxControlElement();
}
}
public class MyTextBoxControlElement : RadTextBoxControlElement
{
protected override TextBoxViewElement CreateViewElement()
{
return new MyTextBoxViewElement();
}
protected override Type ThemeEffectiveType
{
get
{
return typeof(RadTextBoxControlElement);
}
}
}
public class MyTextBoxViewElement : TextBoxViewElement
{
protected override void ReplaceTextBlock(ITextBlock targetBlock, int startCharPosition, int endCharPosition, string text)
{
if (string.IsNullOrEmpty(text) && startCharPosition == 0 && endCharPosition == targetBlock.Length)
{
this.Children.Remove(targetBlock as RadElement);
return;
}
string headText = targetBlock.Text.Substring(0, startCharPosition);
string tailText = targetBlock.Text.Substring(endCharPosition);
targetBlock.Text = headText;
if (TextBoxViewElement.IsSpecialText(text) || this.ContainsNewLine(text))
{
int index = string.IsNullOrEmpty(headText) ? targetBlock.Index : targetBlock.Index + 1;
index = this.InsertTextBlocks(index, text, TextBlockElementType);
if (string.IsNullOrEmpty(headText))
{
targetBlock.Index = index + 1;
}
if (!string.IsNullOrEmpty(headText) && !string.IsNullOrEmpty(tailText))
{
index = this.InsertTextBlocks(index + 1, tailText, TextBlockElementType);
return;
}
}
else
{
targetBlock.Text += text;
}
targetBlock.Text += tailText;
}
public bool ContainsNewLine(string text)
{
string[] words = text.Split(new char[] { ' ', ',', '.', '!', '?' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < words.Length; i++)
{
string word = words[i];
if (!string.IsNullOrEmpty(word) && word == Environment.NewLine)
{
return true;
}
}
return false;
}
}
Html formatting does not work as expected in design-time.
The RadDateTimePicker editor does not allow to edit milliseconds if appropriate format string is applied.
SpellCheckAllAtOnce form should fill the "Change To:" field with the selected word in the suggestions box
Selection in RadDateTimePicker when the culture is ar-SA is not correct. Further, changing the selected date using the arrow keys does not set the right value.
This behavior comes from the nested MaskedEditBox. RadDateTimePicker behaves the same way - this is core logic and should be the same.
1. Create a new project 2. Add a button and on this button start a new form containing RadMarkupEditor 3. Open and close this form several times
SetToNullValue() does not show NullText when ShowUpDown is true
The RadTextBox control should rise the PreviewKeyDown event.