This is a migrated thread and some comments may be shown as answers.

Exception - first letter caps

1 Answer 78 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Koren
Top achievements
Rank 1
Koren asked on 06 Sep 2012, 03:55 PM
I have a masked text input box that I am using in the edit template of a data form.  I have been getting odd exceptions when I try to update the text in this box.  I finally figured out that if I go to the textbox and start with a capital (i.e. shift+alpha key), I get the exception.  If I start typing in the textbox with a lower case alpha character or click the mouse in the box again, I have no problem.

Here is the textbox definition along with the stackpanel for that item:
<StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="1" Margin="0,0,0,5">
                                    <TextBlock Text="Description" Margin="0,0,0,0" VerticalAlignment="Center" Width="{StaticResource LabelWidth}" Style="{StaticResource LabelBoldStyle}" />
                                    <telerikInput:RadMaskedTextInput x:Name="txtDescription" Mask="" Width="{StaticResource LargeLabelWidth}"
                                                                    SpinMode="None" IsClearButtonVisible="False" SelectionOnFocus="SelectAll"
                                                                    TextMode="PlainText" InputBehavior="Replace" SectionsNavigationMode="None"
                                                                    Value="{Binding Description, Mode=TwoWay}" UpdateValueEvent="LostFocus"
                                                                    >
                                    </telerikInput:RadMaskedTextInput>
                                </StackPanel>

Here is the exception that I get:

System.IndexOutOfRangeException was unhandled by user code

  Message=Index was outside the bounds of the array.

  Source=mscorlib

  StackTrace:

       at System.Text.StringBuilder.get_Chars(Int32 index)

       at Telerik.Windows.Controls.RadMaskedInputBase.ClearString(String text, Int32 start, Int32 end, Boolean clearPlaceholders) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 2847

       at Telerik.Windows.Controls.RadMaskedInputBase.ClearString(String str, Boolean clearPlaceholders) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 2833

       at Telerik.Windows.Controls.RadMaskedInputBase.CoerceDisplayText() in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 2431

       at Telerik.Windows.Controls.RadMaskedInputBase.CoerceValue(UpdateValueEvent updateEvent) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 2419

       at Telerik.Windows.Controls.RadMaskedInputBase.OnKeyDownHandled(Char c) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 502

       at Telerik.Windows.Controls.MaskedInput.PreviewInputTextBox.OnTextInput(TextCompositionEventArgs e) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\Input\MaskedInput\PreviewInputTextBox.cs:line 55

       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

       at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)

       at System.Windows.Input.InputManager.ProcessStagingArea()

       at System.Windows.Input.TextCompositionManager.UnsafeCompleteComposition(TextComposition composition)

       at System.Windows.Input.TextCompositionManager.PostProcessInput(Object sender, ProcessInputEventArgs e)

       at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)

       at System.Windows.Input.InputManager.ProcessStagingArea()

       at System.Windows.Input.TextCompositionManager.UnsafeStartComposition(TextComposition composition)

       at System.Windows.Input.TextCompositionManager.PostProcessInput(Object sender, ProcessInputEventArgs e)

       at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)

       at System.Windows.Input.InputManager.ProcessStagingArea()

       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)

       at System.Windows.Interop.HwndKeyboardInputProvider.ProcessTextInputAction(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

       at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)

       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

  InnerException:



1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 11 Sep 2012, 04:23 PM
Hi Koren,

Thank you for reporting this issue. It seems to be related to the no-mask functionality and the TextMode setting - if you remove the TextMode setting (or define the TextMode=MaskedText), the exception isn't raised. So if you don't really need the PlainText TextMode, you can remove it from the definition of the control as a workaround.

In any case, this is a bug and this is why I logged it in our PITS where you can track its progress. I also updated your Telerik account accordingly.

All the best,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Koren
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or