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 am very glad that you have solved your issue. I believe that other community members may benefit from this as well.
Yes! Thanks!
I have been looking into your post and I can suggest using ‘DefaulView’ instead of ‘Rows’ when you set the ‘ItemSource’ of the XamMultiColumnComboEditor like :
xamMultiColumnComboEditor1.ItemsSource = CreateTable(10).DefaultView
If you have any other questions, feel free to ask.
Okay! Now it works. Now the question is how do we get the combobox to display the columns the way the grid does? See below. Thanks!
I have been looking into your posts. I have been trying to reproduce your issue on Windows XP and Windows 7 using the latest version of our Service Release(11.2.20112.2125) and no error occurs. Would you please tell me which specific version of our Server Release you are using ? If possible, would you please test my sample application on another machine and inform me about the result?
I am looking forward to hearing from you.