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

GridViewMaskedTextBoxColumn MouseWheel System.FormatException

7 Answers 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
TONI
Top achievements
Rank 1
TONI asked on 01 Mar 2012, 01:41 PM
Hello telerik team,

I get an System.FormatException when i scroll up or down with my mousewheel in my numeric GridViewMaskedTextBoxColumn cell.

Can you confirm this problem?

My WpfControls Version is 2011.3.1220.40 .

7 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 01 Mar 2012, 03:46 PM
Hello Toni,

I have tested the case, but I was not able to get any exception. Could you take a look at the sample attached and let me know whether I am missing something ?  

Regards,
Maya
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
TONI
Top achievements
Rank 1
answered on 01 Mar 2012, 04:22 PM
Hello Maya,

thank you for your fast answer. Your sample is ok. Can you please change the StadiumCapacity to datatype double? I can reproduce the exception in your sample when i bind datatype double or float. I need a double like this 65,21 . The spin function in the cell works correct via cursor up/down but the spin function via mousewheel crashs.

Thank you in advance!
0
TONI
Top achievements
Rank 1
answered on 02 Mar 2012, 11:38 AM
Here a StackTrace,

[System.FormatException] {"Die Eingabezeichenfolge hat das falsche Format."}

bei System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
bei System.Double.Parse(String s, IFormatProvider provider)
bei Telerik.Windows.Controls.MaskedTextBox.NumericMaskEditingHandler.HandleSpinUp()
bei Telerik.Windows.Controls.MaskedTextBox.NumericMaskHandler.HandleSpinUp()
bei Telerik.Windows.Controls.RadMaskedTextBox.CallSpin(Boolean isUp)
bei Telerik.Windows.Controls.RadMaskedTextBox.HandleSpinBehavior(Boolean isUp)
bei Telerik.Windows.Controls.MaskedTextBox.ExtendedTextBox.OnRootVisualMouseWheel(Object sender, MouseWheelEventArgs e)
bei System.Windows.Input.MouseWheelEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
bei System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
bei System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
bei System.Windows.Input.InputManager.ProcessStagingArea()
bei System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
bei System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
bei System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
bei System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
bei System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
bei MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
bei System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
bei MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
bei MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
bei System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
bei System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
bei System.Windows.Application.RunDispatcher(Object ignore)
bei System.Windows.Application.RunInternal(Window window)
bei System.Windows.Application.Run(Window window)
bei System.Windows.Application.Run()
bei RadGridView_WPF_AR_1.App.Main() in C:\Dokumente und Einstellungen\Administrator\Desktop\340060_RadGridView-WPF-AR-1\RadGridView_WPF_AR_1\obj\x86\Debug\App.g.cs:Zeile 0.
bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
0
TONI
Top achievements
Rank 1
answered on 05 Mar 2012, 02:50 PM
No answer maya? Is there a mistake on my side?
0
Tina Stancheva
Telerik team
answered on 05 Mar 2012, 06:13 PM
Hello Toni,

The issue is caused by the RadMaskedTextBox implementation and this is why I believe it would be best to take advantage of the RadMaskedNumericInput instead:
<telerik:RadGridView Name="clubsGrid"
                        ItemsSource="{Binding Clubs}"
                        AutoGenerateColumns="False"
                        Margin="5">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
                                    Header="Est."
                                    DataFormatString="{}{0:yyyy}"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding StadiumCapacity}" Header="Stadium"
                DataFormatString="{}{0:N0}">
            <telerik:GridViewDataColumn.CellEditTemplate>
                <DataTemplate>
                    <telerik:RadMaskedNumericInput Mask="#4.2" Value="{Binding StadiumCapacity}"/>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellEditTemplate>
        </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>
We created the new suite of MaskedInput controls to get over the many known limitations of the RadMaskedTextBox control. You can examine the behavior of the controls in our demo. The RadMaskedNumericInput control shouldn't cause any exceptions or issues while spinning. But should you encounter any problems with it, please let us know.
Greetings,
Tina Stancheva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
TONI
Top achievements
Rank 1
answered on 06 Mar 2012, 08:38 AM
Hello Tina,

thank you for your answer. The RadMaskedNumericInput works better.
Is it possible (in edit mode) to commit the cell with the return key?



0
Tina Stancheva
Telerik team
answered on 08 Mar 2012, 04:26 PM
Hi Toni,

You can handle the KeyDown event of the MaskedNumericInput and use the CommitEdit() method to commit the changes:
public MainWindow()
{
    InitializeComponent();
    this.AddHandler(RadMaskedNumericInput.KeyDownEvent, new KeyEventHandler(OnKeyDown), true);
}
 
private void OnKeyDown(object sender, KeyEventArgs e)
{
 
    if (e.Key == Key.Enter)
    {
        e.Handled = true;
        clubsGrid.CommitEdit();
    }
}
Give this a try and let me know if it works for you.

All the best,
Tina Stancheva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
TONI
Top achievements
Rank 1
Answers by
Maya
Telerik team
TONI
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or