Hi! I want to be able to generate a data table in code-behind, with the number of columns depending on the number of rows in my data source. I have been able to do this successfully with the xamDataGrid but it seems a similar approach doesn't work for the Multi-Column Combo. The code below generates the error "An item with the same key has already been added" when applied to the multi-column combobox.
Sub Test()
gridTest.DataSource = CreateTable(10).Rows ' works perfectlycboMultiColumn.Columns.Clear()cboMultiColumn .ItemsSource = CreateTable(10).Rows 'does not work :(End SubPrivate Function CreateTable(cols As Integer) As DataTableDim dt As DataTable = New DataTable()For i = 0 To cols - 1dt.Columns.Add("Col " & i)Nextdt.Rows.Add(dt.NewRow)Return dt End Function
Hello greenway,
I have been looking into your post and I have been trying to reproduce your issue following your scenario with no success. Setting the ‘ItemSource’ property of the XamMultiColumnComboEditor does not seem to throw any exception. I am sending you my sample project in Visual Basic version(DataGridMultiComboWithDataTableVBVersion.zip) and in C# version(DataGridMultiComboWithDataTableC#.zip).
If I have misunderstood you in any way, please do not hesitate to tell me.
I am looking forward to hearing from you.
Interesting, I get the same error "An item with the same key has already been added." on startup using your project. Could I be missing an upgrade or something?