WPF SfDataGrid throws System.NullReferenceException when AllowResizingColumns="True"

Hi,

I am using the WPF NuGet version 17.4460.0.55 and I have always manage to get it to crash when I click on the very left of the first column header.  It only crashes when the AllowResizingColumns="True".  I am not sure if I am missing something or if it's a bug, but I looked for and tried everything I could to find a solution.  Below are my xaml and exception detail. Help would be greatly appreciated, and thank you in advance!

Regards,
Phong



<sf:SfDataGrid Grid.Row="1" Name="ProductSeriesDataGrid"  
                       ItemsSource="{Binding ProductSeriesCollection}"  
                       SelectedItem="{Binding SelectedSeries}"     AllowResizingColumns="True"> 
                <sf:SfDataGrid.Columns>
                    <sf:GridTextColumn MappingName="Series" HeaderText="Series"/>
                    <sf:GridTextColumn MappingName="ProductLine" HeaderText="Product Line"/>
                    <sf:GridTextColumn MappingName="ProductCategory" HeaderText="Category" Width="120"/>
                </sf:SfDataGrid.Columns>
</sf:SfDataGrid>



System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Syncfusion.SfGrid.WPF
  StackTrace:
   at Syncfusion.UI.Xaml.Grid.GridHeaderCellControl.GetResizingColumnIndex(Point point)
   at Syncfusion.UI.Xaml.Grid.GridHeaderCellControl.OnMouseLeftButtonDown(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseLeftButtonDownThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   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.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at MX2S.App.Main()


6 Replies

SS Susmitha Sundar Syncfusion Team March 27, 2020 10:00 AM UTC

Hi Phong, 

Thank you for using Syncfusion controls. 

We have checked the reported issue and we are unable to replicate the issue from our end. SfDataGrid’s does not allows to resize the top left line column(Left border of first column). Because it render as DataGrid’s border. You can only resize the inner lines of GridColumns. We suspect that you are customizing the SfDataGrid binded the DataGrid selected value to TextBlock control in MouseDoubleClick event, it is working fine in our end. We have prepared a sample for your reference.   
   
 
We have tested with Syncfusion version 17.4.0.55.   
   
Please check the above sample and revert us if you still facing the same issue? If yes, please modify the sample based on your scenario. It will be helpful for us to check on it and provide you the solution at the earliest.     
   
Regards,   
Susmitha S   




PH Phong March 27, 2020 01:43 PM UTC

Hi, 

Thank you for the example.  I assumed it it was just the AllowResizingColumns alone based on the the exception.  Now that I am using your example, it works well, however when I changed ShowRowHeader="False" or RowHeaderWidth="0" and AllowResizingColumns="True" I get same the exception.

Regards,
Phong


SS Susmitha Sundar Syncfusion Team March 30, 2020 03:09 PM UTC

Hi Phong, 

Thank you for the update. 

We could able to reproduce your reported scenario. Currently, we are analyzing the same. we will check and update you details on April 1,2020. 
 
We appreciate your patience until then. 

Regards, 
Susmitha S 



SS Susmitha Sundar Syncfusion Team April 1, 2020 12:00 PM UTC

Hi Phong, 
 
Thank you for your patience. 
 
We have created bug report for the reported issue. We will fix this and will include this fix with our April 7th NuGet release. Is this okay for you or you want this fix earlier? 
 
You can track the status of this report through the following feedback link,   
 
 
Note: The provided feedback link is private, and you need to login to view this feedback.   
 
Regards, 
Susmitha S 
 



SS Susmitha Sundar Syncfusion Team April 8, 2020 08:43 AM UTC

Hi Phong,  

Sorry for the inconvenience caused.  
  
Due to complexity, we did not include the fix in our this weekly NuGet release(April 7th). We will include this fix in our next NuGet release which will be released on 14th April 2020. 
  
We appreciate your patience until then.  
  
Regards,  
Susmitha S  



SS Susmitha Sundar Syncfusion Team April 16, 2020 11:29 AM UTC

Hi Phong, 
 
We have fixed the mentioned issue “Null reference exception throws while clicking on first column left corner when AllowResizingColumn as true” and included the issue fix in our weekly NuGet update version 18.1.0.44 which is available for download (nuget.org).  
 
We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Susmitha S 


Loader.
Up arrow icon