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

Facing Issues while integrating GanttControl code into my main project?

Hi Team,

Please find attached zip file, 

I'm facing Issues while integrating GanttControl code in my main project-

My App throwing below exception 

InitialSetupBehavior.cs file,

System.NullReferenceException: 'Object reference not set to an instance of an object.'

Syncfusion.Windows.Controls.Gantt.GanttControl.GanttGrid.get returned null.


For more information please find attached zip sample project.

Thanks,











Attachment: WpfAppCamboApp_88d645d5.zip

1 Reply

MK Muneesh Kumar G Syncfusion Team December 13, 2018 10:53 AM UTC

Hi Sharath, 
 
Greetings from Syncfusion. We have analyzed the reported problem with your sample and we were able to reproduce the reported issue at our end. We would like to inform you that while TabControl loading, it loads all controls (placed in all tabs) available in it, even that is not in the view.  
 
Same as GanttControl (in second Tab) gets loaded without initializing its inner element. So that we got NRE while loading the TabControl. To overcome this NRE issue, we have added null check before the inner element (GantttGrid) accessing in GanttControl loaded event. Please find the code snippet as below. 
 
Code snippet : 
void AssociatedObject_Loaded(object sender, RoutedEventArgs e) 
{ 
    if (this.AssociatedObject.GanttGrid != null) 
    { 
        this.AssociatedObject.GanttGrid.UpdateMode = UpdateMode.PropertyChanged; 
 
        // Remove all the columns 
        this.AssociatedObject.GanttGrid.Columns.Clear(); 
 
        GridTreeColumn column = new GridTreeColumn { MappingName = "Range", HeaderText = "Range", Width = 100 }; 
 
        // adding the custom columns to GanttGrid(Table) 
        this.AssociatedObject.GanttGrid.Columns.Add(column); 
    } 
} 
 
NOTE: Already we have resolved this issue and updated the sample in forum 141444. Please download the solution sample from there. 
 
Hope it helps.  
 
Regards, 
Muneesh Kumar G. 


Loader.
Live Chat Icon For mobile
Up arrow icon