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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfDataGrid inside DataTemplate causes NullReferenceException at runtime

Thread ID:





132447 Sep 2,2017 04:46 PM UTC Sep 8,2017 04:16 AM UTC WPF 6
Tags: Ribbon
Asked On September 2, 2017 04:46 PM UTC

Trying to put SfDataGrid inside TabControlExt.ContentTemplate

<sf:TabControlExt Grid.Row="1" ItemsSource="{Binding Tabs}" DisplayMemberPath="Header">
               <sf:SfDataGrid ItemsSource="{Binding GridSource}"/>

I attached stacktrace from runtime exception

When I use standard DataGrid, everything runs fine.
Is this bug? Or maybe I'm doing something wrong?

Attachment: sfdatagridnullreferenceexception_5d6d5768.zip

Steve Schmutzler
Replied On September 3, 2017 09:28 AM UTC

Hello Konstantin,

did u check it with AutoGenerateColumns="False"?

Best regards


Replied On September 3, 2017 09:50 AM UTC

Hello, Steve.

Just checked with AutoGenerateColumns="False". The same exception occurs.

Replied On September 4, 2017 08:40 AM UTC

I believe, I found the reason for this exception happening

Please find attached xaml.

Commented sections caused this.

Is there any way to use styles in this scenario?

Attachment: working_19cdf21d.zip

Keerthana Jegannathan [Syncfusion]
Replied On September 6, 2017 09:53 AM UTC

Hi Konstatantin, 
Thank you for contacting Syncfusion support. 
We have checked the reported behavior of Ribbon based on your updated Xaml code and we were unable to reproduce the NullReference exception from our side. We have prepared a simple sample for your reference and it can be downloaded from the below location. 
Can you check with the above sample for the scenario we have checked and let us know if we have misunderstood your query. Also, as you mentioned that the commented out the resource file can resolve your exception, we request you to apply the resource dictionary in app.Xaml and update whether the issue can be reproduced. If still the issue persists, can you modify the sample which replicates the issue? That will helps us to analyze and provide the solution at earliest. 
Keerthana J 

Replied On September 7, 2017 10:59 AM UTC


I applied ResourceDictionary in App.xaml, everything runs without exceptions from now.

Thank you.

Keerthana Jegannathan [Syncfusion]
Replied On September 8, 2017 04:16 AM UTC

 Hi Konstatantin,

Thanks for your update.

Please let us know if you need further assistance on this.


Keerthana J


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon