Dear Support Team
I would like to make a lookup Column, with autogenerated columns. How can I achieve this. Can I use a template selecter with autogenerated columns? Or do I need to make a specific behaviour class. Which one I do have to overwrite?
This would be an example:
br Patrick
Dear Vijayarasan
Sorry may be my question was not clear enough.
I have a DataSet with Relatated Tables. I would like to show the related Row in a ComboBoxCell.
Let's say in the DataGrid is "Table A" shown. "Table A" has a column with "Table B.ID". Like in the picture in the original post, i would like show another Value from "Table B" in the ID Column. So create a lookup, from Table A to Table B.
Table A:
Team ID | Team Name | Cyclist ID |
001 | Movistar | 001 |
001 | Movistar | 002 |
Table B:
Cyclist ID | Cyclist Name |
001 | John Doe |
002 | Max Willard |
DataGrid what I like to achieve
Team ID | Team Name | Cyclist |
001 | Movistar | Lookup to Table B and show Cyclist Row with ComboBox |
001 | Movistar |
Lookup to Table B and show Cyclist Row with ComboBox
|
Hope this makes it clear.
Thank you. Yes I have seen this possiblity with GridMultiColumnDropDownList. But as I can see, the sample on the help page, does not use "Autogenerate Columns".
How can I achieve this with Autogenerate columns? Because I change the ItemSource of the dataGrid often.
Practically I would like to check before the cell is drawed, if the row/column has a child row and if yes, then use the MultiColumn.
Which method I have to override to achieve this?
Thank you for your Feedback.
//trigger the AutoGenenerate column event
sfDataGrid.AutoGeneratingColumn += sfDataGrid_AutoGeneratingColumn;
private void sfDataGrid_AutoGeneratingColumn(object sender, AutoGeneratingColumnArgs e)
{
//check the column
if (e.Column.MappingName == "ShipCity")
{
//change the Column type GridTextColumn into GridMultiColumnDropDownList in SfDataGrid
if (e.Column is GridTextColumn)
{
//Change the column type in AutoGenerated case
e.Column = new GridMultiColumnDropDownList() { ItemsSource = viewModel.ShipCountry, MappingName = "ShipCity", HeaderText = "Ship City", DisplayMember = "ShipCityName", ValueMember = "ShipCityName" };
}
}
} |