RadDataLayout.LayoutControl has Text property and it is not relevant to show RadMarkupEditor when changing the text.
How to reproduce: radDateTimePicker1.DateTimePickerElement.ShowTimePicker = true; radDateTimePicker1.Format = DateTimePickerFormat.Custom; radDateTimePicker1.DateTimePickerElement.CalendarSize = new Size(330, 250); radDateTimePicker1.ReadOnly = true; Workaround: this.radDateTimePicker1.DateTimePickerElement.ShowTimePicker = true; this.radDateTimePicker1.Format = DateTimePickerFormat.Custom; this.radDateTimePicker1.DateTimePickerElement.CalendarSize = new Size(330, 250); this.radDateTimePicker1.ReadOnly = true; RadDateTimePickerCalendar calendarBehavior = this.radDateTimePicker1.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar; calendarBehavior.TimePicker.TimePickerElement.ReadOnly = true;
To reproduce: please refer to the attached sample screenshots and project. Note: this issue is relevant for RadDropDownList as well. Workaround: this.radDropDownList2.DropDownListElement.TextBox.TextBoxItem.Multiline = true; this.radDropDownList2.DropDownListElement.TextBox.TextBoxItem.MinSize = new Size(30, 15);
How to reproduce: check the attached project and video Workaround: set a minimum size to the control public partial class RadForm1 : RadForm { public RadForm1() { InitializeComponent(); this.radTextBox1.MinimumSize = new Size(0, 20); } }
How to reproduce: add a spellchecker to the form and configure it to spellcheck a multi line text box with a very long text. Workaround: use RadTextBoxControl
To reproduce: this.radTextBox1.NullText = "text"; this.radTextBox1.TextBoxElement.TextBoxItem.NullTextColor = Color.Red; Workaround: this.radTextBox1.TextBoxElement.NullTextColor = Color.Red;
Use attached to reproduce: - Disable and then enable the RadSateTimePicker - You will notice that even the checkbox is unchecked the control is enabled. Workaround: radDateTimePicker1.Enabled =true; if (!radDateTimePicker1.DateTimePickerElement.Checked) { radDateTimePicker1.DateTimePickerElement.TextBoxElement.TextBoxItem.HostedControl.Enabled = false; }
To reproduce: Me.RadDateTimePicker1.Format = DateTimePickerFormat.Custom Me.RadDateTimePicker1.CustomFormat = "MM/dd/yyyy" Dim provider As MaskDateTimeProvider = TryCast(Me.RadDateTimePicker1.DateTimePickerElement.TextBoxElement.Provider, MaskDateTimeProvider) provider.AutoSelectNextPart = True If you type in 01/01/50, RadDateTimePicker displays 01/01/1950 which is correct. If you type in 01/01/2050, the system is again changing the century and display 01/01/1950 which is incorrect. Workaround: use a custom mask provider to customize how the autocompletion work: Public Class CustomMaskDateTimeProvider Inherits Telerik.WinControls.UI.MaskDateTimeProvider Public Sub New(mask As String, culture As CultureInfo, owner As RadMaskedEditBoxElement) MyBase.New(mask, culture, owner) End Sub Protected Overrides Function HandleKeyPress(part As MaskPart, e As KeyPressEventArgs) As Boolean Dim value As Integer = 0 If Not Integer.TryParse(e.KeyChar.ToString(), value) Then Return True End If Dim stringValue As String = String.Empty If part.type = PartTypes.MiliSeconds Then Dim newValue As Integer = CInt((part.value / Math.Pow(10, (3 - part.len)))) * 10 + value part.value = newValue Mod CInt(Math.Pow(10, part.len)) Else stringValue = part.value.ToString() If stringValue.Length = part.len AndAlso stringValue.Length >= part.maskPart.Length Then stringValue = stringValue.Substring(1) End If If Me.AutoCompleteYear AndAlso stringValue.Length = 1 Then stringValue = String.Empty End If part.value = Integer.Parse(stringValue & e.KeyChar) End If If part.type = PartTypes.Year AndAlso part.maskPart.Length = 2 Then Dim len As Integer = part.value.ToString().Length part.value = Integer.Parse(String.Format("{0}{1}", DateTime.Now.Year.ToString().Substring(0, 2), part.value.ToString().Substring(len - 2, 2))) End If If Me.AutoCompleteYear AndAlso part.type = PartTypes.Year Then Dim len As Integer = part.value.ToString().Length If len >= 2 Then part.value = Integer.Parse(part.value.ToString().Substring(len - 2, 2)) End If 'If part.value >= 50 AndAlso part.value <= 99 Then ' part.value += 1900 'ElseIf part.value >= 500 AndAlso part.value <= 999 Then ' part.value += 1000 'ElseIf part.value < 50 OrElse (part.value > 99 AndAlso part.value < 500) Then part.value += 2000 ' End If End If If part.value > part.max OrElse part.value < part.min Then part.value = value End If Return True End Function End Class Me.RadDateTimePicker1.Format = DateTimePickerFormat.Custom Me.RadDateTimePicker1.CustomFormat = "MM/dd/yyyy" Me.RadDateTimePicker1.DateTimePickerElement.TextBoxElement.Provider = New CustomMaskDateTimeProvider(Me.RadDateTimePicker1.DateTimePickerElement.TextBoxElement.Mask, Me.RadDateTimePicker1.Culture, Me.RadDateTimePicker1.DateTimePickerElement.TextBoxElement) Dim provider As MaskDateTimeProvider = TryCast(Me.RadDateTimePicker1.DateTimePickerElement.TextBoxElement.Provider, MaskDateTimeProvider) provider.MaxDate = Me.RadDateTimePicker1.DateTimePickerElement.MaxDate provider.AutoSelectNextPart = True provider.AutoCompleteYear = True Thus, the year always be 2000+.
Use attached to reproduce. - Open the dialog multiple times.
https://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.maskcompleted(v=vs.110).aspx
To reproduce: Me.RadDateTimePicker2.Format = DateTimePickerFormat.Custom Me.RadDateTimePicker2.CustomFormat = "hh:mm tt" Select the hours part with the mouse, the selection is affected correctly. Select the minutes part, the selection is affected correctly. Select the AM/PM part, the selection is again affected correctly. Now, try to select again the minutes part. You will notice that the cursor is affected correctly but the selection is missing. Once you select the AM/PM part then the selection is not updated properly with the mouse anymore. Workaround: Me.RadDateTimePicker1.DateTimePickerElement.TextBoxElement.Provider = New CustomMaskDateTimeProvider(Me.RadDateTimePicker2.DateTimePickerElement.TextBoxElement.Mask, Me.RadDateTimePicker2.Culture, Me.RadDateTimePicker2.DateTimePickerElement.TextBoxElement) Public Class CustomMaskDateTimeProvider Inherits MaskDateTimeProvider Public Sub New(mask As String, culture As CultureInfo, owner As RadMaskedEditBoxElement) MyBase.New(mask, culture, owner) End Sub Public Overrides Function SelectCurrentItemFromCurrentCaret() As Boolean Dim currentSelection As Integer = Me.TextBoxItem.SelectionStart Dim currentPos As Integer = 0 Dim selected As Boolean = False 'If Me.List(Me.SelectedItemIndex).type = PartTypes.AmPm Then ' Return True 'End If For i As Integer = 0 To Me.List.Count - 1 Dim part As MaskPart = Me.List(i) If SelectMilliseconds(i, part) Then Exit For End If If currentSelection >= part.offset AndAlso currentSelection <= part.offset + part.len AndAlso Not part.[readOnly] AndAlso part.type <> PartTypes.Character Then Me.TextBoxItem.SelectionStart = Me.List(i).offset Me.TextBoxItem.SelectionLength = Me.List(i).len Me.SelectedItemIndex = i selected = True Exit For End If currentPos += part.len Next Return selected End Function Private Function SelectMilliseconds(ByVal i As Integer, ByVal part As MaskPart) As Boolean If part.type = PartTypes.MiliSeconds AndAlso Me.value.Millisecond Mod 10 = 0 AndAlso part.trimsZeros Then Dim newLen As Integer = part.len For power As Integer = 1 To part.len If Me.value.Millisecond Mod Math.Pow(10, power) = 0 Then newLen -= 1 Else Exit For End If Next Me.textBoxItem.SelectionStart = Me.list(i).offset Me.textBoxItem.SelectionLength = newLen Me.SelectedItemIndex = i Return True End If Return False End Function End Class
To reproduce: this.radBrowseEditor1.Value = @"D:\Projects"; this.radBrowseEditor1.ReadOnly = false; this.radBrowseEditor1.BrowseElement.ShowClearButton = true; You will notice that the clear button is not shown. Workaround: LightVisualButtonElement btn = new LightVisualButtonElement(); btn.Text = "X"; btn.Click += btn_Click; btn.StretchHorizontally = false; this.radBrowseEditor1.BrowseElement.BrowseButton.Parent.Children.Add(btn); private void btn_Click(object sender, EventArgs e) { this.radBrowseEditor1.Value = null; }
To reproduce: radPopupEditor1.PopupForm.VerticalPopupAlignment = VerticalPopupAlignment.TopToBottom; Workaround: private void RadPopupEditor1_PopupOpening(object sender, CancelEventArgs e) { var args = e as RadPopupOpeningEventArgs; args.CustomLocation = new Point(args.CustomLocation.X, args.CustomLocation.Y - (radPopupEditor1.Height + radPopupEditor1.PopupForm.Height)); }
To reproduce: set the ThemeName property before setting the RadDateTimePickerCalendarShowTimePicker property to true. Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.RadDateTimePicker1.ThemeName = "TelerikMetro" TryCast(Me.RadDateTimePicker1.DateTimePickerElement.CurrentBehavior, RadDateTimePickerCalendar).ShowTimePicker = True End Sub Workaround: Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load TryCast(Me.RadDateTimePicker1.DateTimePickerElement.CurrentBehavior, RadDateTimePickerCalendar).ShowTimePicker = True Me.RadDateTimePicker1.ThemeName = "TelerikMetro" End Sub
To reproduce: please refer to the attached sample project and follow the steps from the provided gif file. Workaround: use RadTextBoxControl.
To reproduce: follow the steps illustrated in the gif file. 1. Set Autosize = false. 2. Resize the control by increasing its height. 3. Change Multiline property to true. 4. Change Multiline property to false. 5. Autosize property is reset by doing 4. So set Autosize to false again. Workaround: Use only the Multiline property.
Hi,
We have an issue with the RadMaskedEditBox control using an f0 mask.
The issue we have is..
When entering a number i.e. 123456 followed by pressing the backspace key, results in the number showing as 123450
We would expect this to show as 12345 so assume this is either a bug or requires up to add additional configuration when using f0.
I have included an example which demonstrates this
Many thanks
Steps:
1) Add a textbox to a form. Set tabindex set to 0.
2) Add a RadMaskedEditBox with tabindex set to 1, and add the code listed below.
public Form1() { InitializeComponent(); this.radMaskedEditBox1.MaskType = MaskType.Standard; this.radMaskedEditBox1.Mask = "000000"; this.radMaskedEditBox1.PromptChar = '#'; this.radMaskedEditBox1.SelectionStart = 0; this.radMaskedEditBox1.SelectionLength = 0; this.radMaskedEditBox1.Enter += radMaskedEditBox1_Enter; this.radMaskedEditBox1.Click += radMaskedEditBox1_Click; this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Click += TextBoxItem_Click; } void radMaskedEditBox1_Enter(object sender, EventArgs e) { this.radMaskedEditBox1.SelectionStart = 0; } void TextBoxItem_Click(object sender, EventArgs e) { this.radMaskedEditBox1.SelectionStart = 0; } void radMaskedEditBox1_Click(object sender, EventArgs e) { }
3) Add breakpoints to all 3 RadMaskedEditBox events.
4) Run the app. Press tab key. (Enter event works as expected for the MaskedEditBox class).
5) Close and re-run app. Click the end of the MaskedEditBox. Click event is not invoked by the MaskedEditBox class as expected.
Expected Result:
Since this control really only has 1 primary subcontrol (a fancy textbox). Event subscriptions to Click should subscribe to MaskedEditBoxElement.TextBoxItem.Click the += operator...
Should be fixed for MouseUp/Down and the all the other related key and mouse events.
Actual Result:
Subscriptions to Enter work on the MaskedEditBox class, but only subscriptions to MaskedEditBoxElement.TextBoxItem.Click work for Click events. This is highly confusing to the programmer whom is used to subscribing the standard Click event of a given control, and makes for unnecessarily complicated code and knowledge of the internal Element structure to make it work as expect like any other control.
Feature request:
It would be nice if there was also a "SelectionStart_MouseClick" property that works similar to SelectionStart but for Click events.
Also a EnableSelectionStart_MouseClick property with a default of false to maintain existing control behavior.
This allows the user to override the default cursor start position for Mouse Clicks. In the case above, the user cannot enter numbers unless they specifically click the start of the Mask; users find that confusing...
The purpose of the above code is to be able to set the cursor start position "on-click", rather than only on Enter, which the existing SelectionStart property doesn't achieve.
Then we programmers could just set the properties and be done with it, and any subscriptions to the Click event would work as expected ->
public Form1() { InitializeComponent(); var customControl = new RadMaskedEditBoxV2() { MaskType = MaskType.Standard, Mask = "000000", PromptChar = '#', SelectionLength = 0, SelectionStart = 0, EnableSelectionStart_MouseClick = true, SelectionLength_MouseClick = 6, SelectionStart_MouseClick = 0 }; this.Controls.Add(customControl); }
public class RadMaskedEditBoxV2 : Telerik.WinControls.UI.RadMaskedEditBox { public RadMaskedEditBoxV2() : base() { this.EnableSelectionStart_MouseClick = false; this.MaskedEditBoxElement.TextBoxItem.Click += SelectionStartMouseClick_OnClick; } public new event EventHandler Click { add { base.MaskedEditBoxElement.TextBoxItem.Click += value; } remove { base.MaskedEditBoxElement.TextBoxItem.Click -= value; } } protected virtual void SelectionStartMouseClick_OnClick(object sender, EventArgs e) { if (EnableSelectionStart_MouseClick) { this.SelectionStart = SelectionStart_MouseClick; this.SelectionLength = SelectionLength_MouseClick; } } public int SelectionStart_MouseClick { get; set; } public int SelectionLength_MouseClick { get; set; } public bool EnableSelectionStart_MouseClick { get; set; } }
It would also allow the programmer to set the Enter and Click SelectionLengths separately.
Regards,
-Shawn.
To reproduce:
- Set SutoSize to false and resize the control vertically.
Workaround:
radMaskedEditBox1.MaskedEditBoxElement.StretchVertically = true;