The issue exist in the versions after Q1 2017
Workaround:
Class MyTextBox
Inherits RadTextBoxControl
Protected Overrides Function CreateTextBoxElement() As RadTextBoxControlElement
Return New MyTextBoxElement()
End Function
End Class
Class MyTextBoxElement
Inherits RadTextBoxControlElement
Protected Overrides ReadOnly Property ThemeEffectiveType As Type
Get
Return GetType(RadTextBoxControlElement)
End Get
End Property
Protected Overrides Function CreateViewElement() As TextBoxViewElement
Return New MyWrapPanel
End Function
End Class
Class MyWrapPanel
Inherits TextBoxViewElement
Protected Overrides Function InsertTextBlocks(index As Integer, text As String, blockType As Type) As Integer
If String.IsNullOrEmpty(text) Then
Return index
End If
Dim textBuilder As New StringBuilder()
For i As Integer = 0 To text.Length - 1
Dim symbol As Char = text(i)
If Char.IsWhiteSpace(symbol) OrElse symbol = TextBoxViewElement.TabSymbol OrElse symbol = TextBoxViewElement.LineFeedSymbol OrElse symbol = TextBoxViewElement.CarriageReturnSymbol Then
If textBuilder.Length > 0 Then
Dim textBlock As ITextBlock = Me.CreateBlock(textBuilder.ToString(), blockType)
If index >= Me.Children.Count Then
Me.Children.Add(TryCast(textBlock, RadElement))
index = Me.Children.Count - 1
textBlock.Index = index
Else
textBlock.Index = index
Me.Children.Insert(index, TryCast(textBlock, RadElement))
End If
textBuilder = New StringBuilder()
index += 1
End If
Dim tabBlock As ITextBlock = Me.CreateBlock(symbol.ToString(), blockType)
tabBlock.Index = index
Me.Children.Insert(index, TryCast(tabBlock, RadElement))
index += 1
Continue For
End If
textBuilder.Append(symbol)
Next
If textBuilder.Length > 0 Then
Dim textBlock As ITextBlock = Me.CreateBlock(textBuilder.ToString(), blockType)
textBlock.Index = index
Me.Children.Insert(index, TryCast(textBlock, RadElement))
index += 1
End If
Return index - 1
End Function
End Class
Please refer to the attached sample project and attached gif file which illustrates the desired behavior when RadForm1 is run. If you run RadForm2 which uses RadDropDownList, the binding doesn't work as expected.
Workaround:
this.radDropDownList1.SelectedIndexChanged += RadDropDownList1_SelectedIndexChanged;
this.radDropDownList1.DisplayMember = "Naziv";
this.radDropDownList1.ValueMember = "Id";
this.radDropDownList1.DataSource = bs;
private void RadDropDownList1_SelectedIndexChanged(object sender,
Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{
if (e.Position > -1)
{
Roditelj parent = this.radDropDownList1.SelectedItem.DataBoundItem as Roditelj;
this.radDropDownList2.DataSource = null;
this.radDropDownList2.DisplayMember = "Naziv";
this.radDropDownList2.ValueMember = "Id";
this.radDropDownList2.DataSource = parent.Djeca;
}
}
Please refer to the attached sample project and try to open the form's designer. If you comment [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] for the EditarTextBox property (typeof(RadTextBox)), clean and rebuild, the designer is opened as expected. Workaround: use RadTextBoxControl.
How to reproduce:
this.radMaskedEditBox1.Font = new System.Drawing.Font("Segoe UI", 20F);
this.radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Standard;
this.radMaskedEditBox1.Mask = "#####-######";
this.radMaskedEditBox1.Value = "47997006886";
Workaround:
this.radMaskedEditBox1.Font = new System.Drawing.Font("Segoe UI", 20F);
this.radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Standard;
this.radMaskedEditBox1.Mask = "#####-######";
this.radMaskedEditBox1.Text = "47997006886";
To reproduce: - Add text that contain multiple blank lines to a textBox - Set SpellCheckMode to AllAtOnce - Perform a spell check.
To reproduce: - Set the mask to IP. - Change the culture to German. Workaround: Set the Culture of the RadMaskedEditBox to English.
To reproduce:
public Form1()
{
InitializeComponent();
this.radMaskedEditBox1.Mask = "9999999999";
this.radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Standard;
this.radMaskedEditBox1.PromptChar = Convert.ToChar(" ");
}
private void radButton1_Click(object sender, EventArgs e)
{
this.radMaskedEditBox1.Clear();
this.radLabel1.Text = "Value = " + this.radMaskedEditBox1.Value + Environment.NewLine + "Text = " + this.radMaskedEditBox1.Text;
}
Workaround: set the Value to null as well.
Workaround: use simple data binding with the editor and its Text property
this.radCalculatorDropDown1.CalculatorElement.EditorContentElement.TextBoxItem.DataBindings.Add("Text", testObject, "TestValue", false, DataSourceUpdateMode.OnPropertyChanged);
Users cannot edit the A/P symbols with CustomMask set to "hh:mm:sst" or "hh:mm:sstt"
How to reproduce: 1. Install Telerik Controls (version: 2016.3.1024) 2. Launch Visual studio. Create Windows application project. 3. Drop RadPopupContainer from the toolbox on to the windows form. Save the form. 4. Mouse click on the control on design canvas to select RadScrollablePanelContainer panel. 5. Now click on smart tag of RadScrollablePanelContainer panel and select "Undock in parent container" option. 6. Now separate RadScrollablePanelContainer panel by moving it to some location on the form. Save the form. 7. Try to move RadPopupContainer. Observe that it does not allow to move. 8. Click on the smart tag of RadScrollablePanelContainer panel and select "Dock in parent" option. Observe that the RadScrollablePanelContainer panel is not docked into the RadPopupContainer control.
To reproduce:
this.radDateTimePicker1.MinDate = DateTime.Now;
this.radDateTimePicker1.MaxDate = DateTime.Now;
Please refer to the attached screenshots. Although the user is not allowed to change the selection, the future dates are not grayed out as the dates before the MinDate.
Workaround:
public RadForm1()
{
InitializeComponent();
this.radDateTimePicker1.MinDate = DateTime.Now;
this.radDateTimePicker1.MaxDate = DateTime.Now;
RadDateTimePickerCalendar calendarBehavior = this.radDateTimePicker1.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar;
calendarBehavior.Calendar.ElementRender += Calendar_ElementRender;
}
private void Calendar_ElementRender(object sender, RenderElementEventArgs e)
{
if (e.Day.Date > this.radDateTimePicker1.MaxDate.Date || e.Day.Date < this.radDateTimePicker1.MinDate.Date)
{
e.Element.Enabled = false;
}
else
{
e.Element.Enabled = true;
}
}
The value set to the last spin editor is overridden with its previous value.
How to reproduce: check the attached videos
Workaround:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.radColorBox1.ValueChanging += radColorBox1_ValueChanging;
((RadForm)this.radColorBox1.ColorBoxElement.ColorDialog.ColorDialogForm).FormClosing += Form1_FormClosing;
}
bool cancelValueChange;
Telerik.WinControls.UI.RadColorPicker.ProfessionalColors professionalColors;
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Control colorSelector = this.radColorBox1.ColorBoxElement.ColorDialog.ColorDialogForm.RadColorSelector;
RadPageView pageView = colorSelector.Controls[3] as RadPageView;
if (pageView.SelectedPage.TabIndex == 3)
{
cancelValueChange = true;
professionalColors = pageView.Pages[3].Controls[0] as Telerik.WinControls.UI.RadColorPicker.ProfessionalColors;
}
else
{
professionalColors = null;
}
}
private void radColorBox1_ValueChanging(object sender, Telerik.WinControls.UI.ValueChangingEventArgs e)
{
if (cancelValueChange && professionalColors != null)
{
e.Cancel = true;
RadSpinEditor alphaSpinEditor = professionalColors.Controls[12] as RadSpinEditor;
RadSpinEditor redSpinEditor = professionalColors.Controls[15] as RadSpinEditor;
RadSpinEditor greenSpinEditor = professionalColors.Controls[11] as RadSpinEditor;
RadSpinEditor blueSpinEditor = professionalColors.Controls[7] as RadSpinEditor;
cancelValueChange = false;
this.radColorBox1.Value = Color.FromArgb((int)alphaSpinEditor.Value, (int)redSpinEditor.Value, (int)greenSpinEditor.Value, (int)blueSpinEditor.Value);
}
}
}
To reproduce:
Add the following line of code:
[C#]
this.radSpellChecker1.SpellCheckMode = Telerik.WinControls.UI.SpellCheckMode.AllAtOnce;
[VB.NET]
Me.RadSpellChecker1.SpellCheckMode = Telerik.WinControls.UI.SpellCheckMode.AllAtOnce
When you spell check RadRichTextBox and the spell check form is opened click the change button. You will notice that the word will not changed in the original RadRichTextBox.
this.radSpellChecker1.RegisterControlSpellChecker(typeof(RadRichTextBox), new MyRichTextBoxSpellChecker());
this.radSpellChecker1.SpellCheckMode = SpellCheckMode.AllAtOnce;
Workaround:
class MyRichTextBoxSpellChecker : RadRichTextBoxSpellChecker
{
public override Telerik.WinControls.RichTextBox.Model.RadDocument GetContentAsDocument()
{
return (this.CurrentControl as RadRichTextBox).Document;
}
}
To reproduce: - Add RichTextBox and type two words each on a separate line. - Perform spell check using the following code: radSpellChecker1.SpellCheckMode = SpellCheckMode.WordByWord; radSpellChecker1.Check(richTextBox1); The result is shown on the attached image.
Steps to reproduce. 1. Add a RadTextBoxControl and a button to a form 2. On the button click set a large text (the text from a 150KB text file) to the Text property of the text box. You will see that the control takes a lot of time to complete the operation.
To reproduce: add a RadMaskedEditBox and use the following code:
Sub New()
InitializeComponent()
Me.RadMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Numeric
Me.RadMaskedEditBox1.Mask = "N1"
Dim item As Item = New Item(Nothing, "Item1")
RadMaskedEditBox1.DataBindings.Add("Value", item, "StockTypeId", True, DataSourceUpdateMode.OnPropertyChanged)
End Sub
Public Class Item
Private _stockId As Nullable(Of Integer)
Public Sub New(value As Nullable(Of Integer), name As String)
Me._stockId = value
End Sub
Public Property StockTypeId() As Nullable(Of Integer)
Get
Return _stockId
End Get
Set(ByVal value As Nullable(Of Integer))
_stockId = value
Console.WriteLine(value)
End Set
End Property
End Class
The user is not allowed to enter a new numeric value.
Wokraround:
Public Class CustomNumericCharacterTextBoxProvider
Inherits NumericCharacterTextBoxProvider
Private owner As RadMaskedEditBoxElement
Public Sub New(mask As String, culture As CultureInfo, numericType As NumericCharacterTextBoxProvider.RadNumericMaskFormatType, _
owner As RadMaskedEditBoxElement)
MyBase.New(mask, culture, numericType, owner)
Me.owner = owner
End Sub
Protected Overrides Function AllowAppendCharacters() As Boolean
If owner.Text = "" AndAlso owner.Mask = "N1" Then
Return True
End If
Return MyBase.AllowAppendCharacters()
End Function
End Class
Public Class CustomMaskedEditBox
Inherits RadMaskedEditBox
Public Overrides Property ThemeClassName As String
Get
Return GetType(RadMaskedEditBox).FullName
End Get
Set(value As String)
MyBase.ThemeClassName = value
End Set
End Property
Public Sub New()
MyBase.New()
Me.MaskType = Telerik.WinControls.UI.MaskType.Numeric
Me.Mask = "N1"
Dim numericMaskProvider As NumericMaskTextBoxProvider = Me.MaskedEditBoxElement.Provider
Dim fi As FieldInfo = GetType(NumericMaskTextBoxProvider).GetField("provider", BindingFlags.Instance Or BindingFlags.NonPublic)
fi.SetValue(numericMaskProvider, _
New CustomNumericCharacterTextBoxProvider(numericMaskProvider.Mask, numericMaskProvider.Culture, _
NumericMaskTextBoxProvider.GetFormat(numericMaskProvider.Mask, numericMaskProvider.Culture), _
Me.MaskedEditBoxElement))
End Sub
End Class
To reproduce:
- Set the provider to FreeFormDateTimeProvider
- Bind the control to a value.
- Clear the date and tab out of the control.
Workaround:
Seth the value in the ParsingDateTime event handler:
if (e.InputString == "")
{
this.SetToNullValue();
}
Description: When binding to a null value, the RadSpinEditor throws an exception. This missing functionality is also noticed with the standard Windows Numeric Up Down control.
How to reproduce:
- add a RadSpinEditor and two RadButtons;
- use the following code:
public partial class Form1 : Form
{
private BindingSource _bindActiveObject = new BindingSource { DataSource = typeof(MyBindingObject) };
public Form1()
{
InitializeComponent();
this.radSpinEditor1.DataBindings.Add(new Binding("Value", _bindActiveObject, "MyValue"));
}
private void radButton1_Click(object sender, EventArgs e)
{
_bindActiveObject.DataSource = new MyBindingObject { MyValue = Convert.ToDouble(100) };
}
private void radButton2_Click(object sender, EventArgs e)
{
_bindActiveObject.DataSource = new MyBindingObject { MyValue = null };
}
}
public class MyBindingObject
{
private decimal? _myValue;
public decimal? MyValue
{
get
{
return _myValue;
}
set
{
_myValue = value;
}
}
}
Workaround:
Use the following custom RadSpinEditor:
private BindingSource _bindActiveObject = new BindingSource { DataSource = typeof(MyBindingObject) };
public Form1()
{
InitializeComponent();
this.radSpinEditor1.NullableValueChanged += Form1_NullableValueChanged;
this.radSpinEditor1.DecimalPlaces = 2;
this.radSpinEditor1.DataBindings.Add(new Binding("NullableValue", _bindActiveObject,
"MyValue", true, DataSourceUpdateMode.OnPropertyChanged));
}
private void Form1_NullableValueChanged(object sender, EventArgs e)
{
Console.WriteLine("NullableValue = " + this.radSpinEditor1.NullableValue + "");
}
private void radButton1_Click(object sender, EventArgs e)
{
MyBindingObject obj = new MyBindingObject { MyValue = 65.45m };
_bindActiveObject.DataSource = obj;
}
private void radButton2_Click(object sender, EventArgs e)
{
_bindActiveObject.DataSource = new MyBindingObject { MyValue = null };
}
public class MyBindingObject
{
private decimal? _myValue;
public decimal? MyValue
{
get
{
return _myValue;
}
set
{
_myValue = value;
}
}
}
public class MySpinEditor : RadSpinEditor
{
public event EventHandler NullableValueChanged;
public decimal? NullableValue
{
get
{
return (this.SpinElement as MySpinEditorElement).NullableValue;
}
set
{
(this.SpinElement as MySpinEditorElement).NullableValue = value;
}
}
public MySpinEditor()
{
this.AutoSize = true;
this.TabStop = false;
base.SetStyle(ControlStyles.Selectable, true);
}
protected override void CreateChildItems(RadElement parent)
{
Type baseType = typeof(RadSpinEditor);
MySpinEditorElement element = new MySpinEditorElement();
element.RightToLeft = this.RightToLeft == System.Windows.Forms.RightToLeft.Yes;
this.RootElement.Children.Add(element);
element.ValueChanging += spinElement_ValueChanging;
element.ValueChanged += spinElement_ValueChanged;
element.TextChanging += spinElement_TextChanging;
element.NullableValueChanged += element_NullableValueChanged;
element.KeyDown += OnSpinElementKeyDown;
element.KeyPress += OnSpinElementKeyPress;
element.KeyUp += OnSpinElementKeyUp;
baseType.GetField("spinElement", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(this, element);
}
void element_NullableValueChanged(object sender, EventArgs e)
{
if (this.NullableValueChanged != null)
{
this.NullableValueChanged(this, EventArgs.Empty);
}
}
private Dictionary<string, MethodInfo> cache = new Dictionary<string, MethodInfo>();
private void InvokeBaseMethod(string name, params object[] parameters)
{
if (!cache.ContainsKey(name))
{
cache[name] = typeof(RadSpinEditor).GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic);
}
cache[name].Invoke(this, parameters);
}
private void OnSpinElementKeyUp(object sender, KeyEventArgs e)
{
this.InvokeBaseMethod("OnSpinElementKeyUp", sender, e);
}
private void OnSpinElementKeyPress(object sender, KeyPressEventArgs e)
{
this.InvokeBaseMethod("OnSpinElementKeyPress", sender, e);
}
private void OnSpinElementKeyDown(object sender, KeyEventArgs e)
{
this.InvokeBaseMethod("OnSpinElementKeyDown", sender, e);
}
private void spinElement_TextChanging(object sender, TextChangingEventArgs e)
{
this.InvokeBaseMethod("spinElement_TextChanging", sender, e);
}
private void spinElement_ValueChanged(object sender, EventArgs e)
{
this.InvokeBaseMethod("spinElement_ValueChanged", sender, e);
this.NullableValue = this.Value;
}
private void spinElement_ValueChanging(object sender, ValueChangingEventArgs e)
{
this.InvokeBaseMethod("spinElement_ValueChanging", sender, e);
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Tab)
{
(this.SpinElement as MySpinEditorElement).CommitText();
}
else if (keyData== Keys.Delete)
{
(this.SpinElement as MySpinEditorElement).NullableValue = null;
}
return base.ProcessCmdKey(ref msg, keyData);
}
protected override Size DefaultSize
{
get
{
return GetDpiScaledSize(new Size(100, 20));
}
}
}
public class MySpinEditorElement : RadSpinElement
{
private bool validating;
private decimal? nullableValue;
private RadButtonElement nullButton;
public decimal? NullableValue
{
get
{
return this.nullableValue;
}
set
{
this.nullableValue = value;
if (value.HasValue)
{
this.internalValue = value.Value;
}
else
{
this.internalValue = 0m;
}
this.Validate();
this.OnNullableValueChanged();
}
}
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
this.CommitText();
e.Handled = true;
return;
}
base.OnKeyDown(e);
}
void nullButton_Click(object sender, EventArgs e)
{
this.NullableValue = null;
}
public virtual void CommitText()
{
this.NullableValue = this.GetValueFromText();
}
protected override decimal GetValueFromText()
{
if (this.TextBoxItem.Text == "")
{
return 0m;
}
return base.GetValueFromText();
}
public override bool Validate()
{
if (!this.NullableValue.HasValue)
{
this.TextBoxItem.Text = "";
return true;
}
this.TextBoxItem.Text = this.GetTextFromNumber(this.NullableValue.HasValue ? this.internalValue : 0m, this.Hexadecimal,
this.ThousandsSeparator, this.DecimalPlaces);
return true;
}
private string GetTextFromNumber(decimal num, bool hex, bool thousands, int decimalPlaces)
{
if (hex)
{
return string.Format("{0:X}", (long)num);
}
return num.ToString((thousands ? "N" : "F") + decimalPlaces.ToString(CultureInfo.CurrentCulture), CultureInfo.CurrentCulture);
}
public override void PerformStep(decimal step)
{
decimal value = this.GetValueFromText();
try
{
decimal incValue = value + step;
value = incValue;
}
catch (OverflowException)
{
}
this.NullableValue = this.Constrain(value);
this.Validate();
}
protected override Type ThemeEffectiveType
{
get
{
return typeof(RadSpinElement);
}
}
public event EventHandler NullableValueChanged;
protected virtual void OnNullableValueChanged()
{
if (this.NullableValueChanged != null)
{
this.NullableValueChanged(this, EventArgs.Empty);
}
}
}
To reproduce: please refer to the attached gif file.
The error is applicable for all controls that use RadColorDialog while editing, e.g. RadGridView, RadPropertyGrid.
Workaround: disable the spineditors:
private void RadPropertyGrid1_EditorInitialized(object sender, Telerik.WinControls.UI.PropertyGridItemEditorInitializedEventArgs e)
{
PropertyGridColorEditor colorEditor = e.Editor as PropertyGridColorEditor;
if (colorEditor !=null)
{
RadColorBoxElement el = colorEditor.EditorElement as RadColorBoxElement;
((RadForm)el.ColorDialog.ColorDialogForm).Load += ColorDialogForm_Load1;
}
}
private void ColorDialogForm_Load1(object sender, EventArgs e)
{
RadColorDialogForm form = sender as RadColorDialogForm;
RadPageView pageView = form.RadColorSelector.Controls["radPageView1"] as RadPageView;
Telerik.WinControls.UI.RadColorPicker.ProfessionalColors professionalColors =
pageView.Pages[3].Controls["professionalColorsControl"] as Telerik.WinControls.UI.RadColorPicker.ProfessionalColors;
foreach (Control c in professionalColors.Controls )
{
RadSpinEditor spinEditor = c as RadSpinEditor;
if (spinEditor!=null)
{
spinEditor.SpinElement.TextBoxItem.Enabled = false;
}
}
}