Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
285
Self-related hierarchical structure throws StackOverflowException
posted

I have a Task class that look like this:

public class Task
{
  public ObservableCollection<Task>SubTasks { get; set; }
  public string Description { get; set; }
  public string User { get; set; }
  public bool IsSelected { get; set; }
}

I'm setting the ItemsSource property on my grid to an instance of an ObservableCollection<Task> and expect to see the whole hierachy in the grid.

According to the documentation it should work if I define my xaml like this:

<igGrid:XamWebGrid
 
x:Name="TaskGrid"
  AutoGenerateColumns="False"
 
ItemsSource="{Binding Tasks}">

<igGrid:XamWebGrid.ColumnLayouts>
  <igGrid:ColumnLayout Key="somekey" TargetTypeName="Task">
   
<igGrid:ColumnLayout.Columns>
     
<igGrid:TextColumn Key="Description" />
     
<igGrid:TextColumn Key="User" />
     
<igGrid:CheckBoxColumn Key="IsSelected" />
    
</igGrid:ColumnLayout.Columns>
 
</igGrid:ColumnLayout>
</igGrid:XamWebGrid.ColumnLayouts>

</igGrid:XamWebGrid>

The documentation I'm refering to is the last section at http://help.infragistics.com/NetAdvantage/Silverlight/2009.2/CLR3.5/

Problem is that this blows up with a StackOverflowException as soon as I set the data source on the grid.

There must be something missing in this sample, but I can't figure it out. Setting MaxDepth doesn't help either (but I wouldn't expect 3 levels to be too much for it anyway).

The sample in the documentation refers to some Employee data source but I can't find any code for that anywhere.