We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SfDatagrid.QueryRowHeight Object reference not set to an instance of an object

Hello,

All the columns of mySfDatagrid are of type GridTemplateColumn.
Within the eventQueryRowHeight I am having this piece of code following this documentation:https://help.syncfusion.com/xamarin/sfdatagrid/row-height-customization

e.Height = MyDataGrid.GetRowHeight(e.RowIndex);

However this line of code results in the following exception.

Object reference not set to an instance of an object

at Syncfusion.SfDataGrid.XForms.iOS.MeasureSize.Convert (Xamarin.Forms.View view, Xamarin.Forms.VisualElement valid) [0x0002c] in <0ef2f7400f5e42cd927535fd5a7e7125>:0
at Syncfusion.SfDataGrid.XForms.iOS.MeasureSize.CalculateHeight (Syncfusion.SfDataGrid.XForms.SfDataGrid grid, Syncfusion.SfDataGrid.XForms.GridColumn column, Xamarin.Forms.View view) [0x0000a] in <0ef2f7400f5e42cd927535fd5a7e7125>:0
at Syncfusion.SfDataGrid.XForms.SfDataGridHelpers.GetTemplateHeight (Syncfusion.SfDataGrid.XForms.SfDataGrid grid, Syncfusion.SfDataGrid.XForms.GridColumn column, System.Object rowData, System.Int32 rowIndex) [0x00060] in <8552459926bc463da39386ee2af01173>:0
at Syncfusion.SfDataGrid.XForms.SfDataGridHelpers.GetRowHeight (Syncfusion.SfDataGrid.XForms.SfDataGrid datagrid, System.Object rowData, System.Int32 rowIndex, Syncfusion.SfDataGrid.XForms.GridRowSizingOptions options) [0x0012e] in <8552459926bc463da39386ee2af01173>:0
at Syncfusion.SfDataGrid.XForms.SfDataGridHelpers.GetRowHeight (Syncfusion.SfDataGrid.XForms.SfDataGrid dataGrid, System.Int32 rowIndex, Syncfusion.SfDataGrid.XForms.GridRowSizingOptions options) [0x00107] in <8552459926bc463da39386ee2af01173>:0
at Yallax.DataBorer.Crypto.Xamarin.Pages.Exchanges.ExchangeInfoPage.Handle_ExchangeCurrencyPairLinksDataGrid_QueryRowHeight (System.Object sender, Syncfusion.SfDataGrid.XForms.QueryRowHeightEventArgs e) [0x00020] in /Users/danielk/Code/Azure DevOps/yallax/DataBorer/src/DataBorer.Crypto.Xamarin/Pages/Exchanges/ExchangeInfoPage.xaml.cs:22
at Syncfusion.SfDataGrid.XForms.SfDataGrid.RaiseQueryRowHeight (Syncfusion.SfDataGrid.XForms.QueryRowHeightEventArgs e) [0x00008] in <8552459926bc463da39386ee2af01173>:0
at Syncfusion.SfDataGrid.XForms.RowGenerator.QueryRowHeight (System.Int32 rowIndex, System.Double& height) [0x00011] in <8552459926bc463da39386ee2af01173>:0
at Syncfusion.SfDataGrid.XForms.VisualContainer.SetRowHeights () [0x0016d] in <8552459926bc463da39386ee2af01173>:0
at Syncfusion.SfDataGrid.XForms.VisualContainer.OnSizeAllocated (System.Double width, System.Double height) [0x00242] in <8552459926bc463da39386ee2af01173>:0
at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:793
at Xamarin.Forms.Layout.ForceLayout () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:125
at Syncfusion.SfDataGrid.XForms.SfDataGrid.OnItemsSourceChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x002e7] in <8552459926bc463da39386ee2af01173>:0
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:624
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:422
at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x00220] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:167
at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:57
at Xamarin.Forms.BindingExpression+BindingExpressionPart.b__49_0 () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:618
at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.15/src/Xamarin.iOS/Foundation/NSAction.cs:152
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.15/src/Xamarin.iOS/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.15/src/Xamarin.iOS/UIKit/UIApplication.cs:63
at Yallax.DataBorer.Crypto.Xamarin.iOS.Application.Main (System.String[] args) [0x00002] in /Users/danielk/Code/Azure DevOps/yallax/DataBorer/src/DataBorer.Crypto.Xamarin.iOS/Main.cs:16

Thank you for your support
Daniel K.

1 Reply

SP Subburaj Pandian Veluchamy Syncfusion Team February 18, 2019 10:34 AM UTC

Hi Daniel, 
  
Thank you for contacting Syncfusion support. 
 
Based on the provided information, we have checked your query “Exception is raised when we calculate row height in QueryRowHeight event when all the columns are template column” with latest update version 16.4.0.53 and it is working fine from our side. We have attached the tested sample for you reference and you can download the same from the below link.  
  
 
If the given sample doesn’t meet your requirement, please modify the sample based on your scenario and revert to us to reproduce the issue from our side. It will be helpful for us to validate the issue and provide you the solution at earlier.  
 
Regards,
Subburaj Pandian V   


Loader.
Up arrow icon