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 crashes on initialization when Theme is applied

When using Theme in ResourceDictionary accordingly to documentation, sfDataGrid crashes application. Dark or light theme, with or without binding to data, doesn't matter, grid crashes . I have tried grid with own DataGridStyle and still crashes. Any suggestions? Thank you

app.xaml:

xmlns:syncTheme="clr-namespace:Syncfusion.XForms.Themes;assembly=Syncfusion.Core.XForms"

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <syncTheme:SyncfusionThemeDictionary>
                    <syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
                        <syncTheme:DarkTheme />
                    </syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
                </syncTheme:SyncfusionThemeDictionary>

Exception:

{System.NullReferenceException: Object reference not set to an instance of an object.
   at Syncfusion.SfDataGrid.XForms.ThemeGridStyle.OnDataGridBackgroundColorChanged(BindableObject bindable, Object oldValue, Object newValue)
   at Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
   at Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
   at Xamarin.Forms.Element.OnSetDynamicResource(BindableProperty property, String key)
   at Xamarin.Forms.BindableObject.SetDynamicResource(BindableProperty property, String key, Boolean fromStyle)
   at Syncfusion.SfDataGrid.XForms.ThemeGridStyle..ctor()
   at Syncfusion.SfDataGrid.XForms.SfDataGrid.Syncfusion.XForms.Themes.IThemeElement.OnControlThemeChanged(String oldTheme, String newTheme)
   at Syncfusion.XForms.Themes.ThemeElement.OnControlThemeChanged(BindableObject bindable, Object oldValue, Object newValue)
   at Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
   at Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
   at Xamarin.Forms.Element.OnSetDynamicResource(BindableProperty property, String key)
   at Xamarin.Forms.BindableObject.SetDynamicResource(BindableProperty property, String key, Boolean fromStyle)
   at Xamarin.Forms.Element.SetDynamicResource(BindableProperty property, String key)
   at Syncfusion.XForms.Themes.ThemeElement.InitializeThemeResources(Element element, String controlKey)
   at Syncfusion.SfDataGrid.XForms.SfDataGrid..ctor()
   at sfThemingTest.Views.GridPage.InitializeComponent()
   at sfThemingTest.Views.GridPage..ctor()
   at sfThemingTest.Views.MainPage.<NavigateFromMenu>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at sfThemingTest.Views.MenuPage.<<-ctor>b__3_0>d.MoveNext()}


3 Replies

MI Michal April 5, 2019 12:28 PM UTC

Tested with Xam 3.4 and 3.6, Sf 17.0.1.38, uwp and android


SP Subburaj Pandian Veluchamy Syncfusion Team April 8, 2019 01:38 PM UTC

Hi Michal, 
  
Thank you for contacting Syncfusion support. 
  
Based on the provided information, we have checked and we can able to replicate the mentioned issue “Throws null exception when setting Theme to DataGrid” in Application Xamarin.Forms and logged issue report for the same. We will fix the issue and include this in our upcoming weekly NuGet release update which is expected be available by next week (April 17, 2019). We appreciate your patience until then. 
   
Regards,
Subburaj Pandian V 



SP Subburaj Pandian Veluchamy Syncfusion Team April 16, 2019 10:26 AM UTC

Hi Michal,

We have fixed the reported issue “Throws null exception when setting Theme to DataGrid” in Xamarin.Forms and included the issue fix in our latest weekly NuGet package update version 17.1.0.41 and 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,
Subburaj Pandian V 


Loader.
Live Chat Icon For mobile
Up arrow icon