I am building an application and am running into an issue I can't seem to figure out. I have the latest (as of 1/17/2018) Syncfusion bits and am running the latest Visual Studio 2017 (15.5.4). I have built a simple repro of my app and that works so it must be something I am doing in my app but I can't seem to figure it out. Hoping someone here may have run into this or can give me some pointers.
I am using the sfDataGrid control and I am trying to bind a List to the ItemsSource in my code behind. If I leave AutoGenerateColumns = 'True' all works as it should but I am getting all the columns, I only want a handful. When I set AutoGenerateColumns = 'False' and set the SfDataGrid.Columns up in the XAML with only the columns I want to show I crash when setting the ItemsSource to my collection. I receive the following error:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Here is my XAML:
<sfdg:SfDataGrid x:Name="RankingDataGrid"
ColumnSizer="Auto"
AutoGenerateColumnsMode="None"
AutoGenerateColumns="False"
BackgroundColor="#404040">
<sfdg:SfDataGrid.Columns x:TypeArguments="syncfusion:Columns">
<sfdg:GridTextColumn HeaderText="Rank"
MappingName="National.Current.Rank" />
<sfdg:GridTextColumn HeaderText="Team"
MappingName="TeamName" />
<sfdg:GridTextColumn HeaderText="Wins"
MappingName="National.Current.Wins" />
<sfdg:GridTextColumn HeaderText="Losses"
MappingName="National.Current.Losses" />
<sfdg:GridTextColumn HeaderText="Matches"
MappingName="National.Current.Matches" />
<sfdg:GridTextColumn HeaderText="Win %"
MappingName="National.Current.WinsRatio" />
</sfdg:SfDataGrid.Columns>
</sfdg:SfDataGrid>
In the codebehind I simply do this:
RankingDataGrid.ItemsSource = ranking.Teams;
Anyone have any pointers or ideas? Did I miss a step? Forget to set a property? Like I said, I tried to create a simple repro to show it was a bug, but my repro actually works so I'm at a loss.