Is it possible to load a list of items into the combobox over an ObservableCollection in the SFDataGrid and pre-select one item
I have a ObservableCollection:
ObservableCollection<TrackSection> trackSection = new ObservableCollection<TrackSection>();
public class TrackSection
{
public int SectionID { get; set; }
public int SectionTrackID { get; set; }
public int SectionIncr { get; set; }
public string SectionName { get; set; }
public string SectionDescription { get; set; }
public List<string> SurfaceList { get; set; }
}
Load Data into the SFDataGrid
var trackList = await App.Database.GetTrackSectionItemAsync(LoadDB);
foreach (var TrackList in trackList)
{
trackSection.Add(new TrackSection { SectionID = TrackList.SectionID, SectionName = TrackList.SectionName, SectionDescription = TrackList.SectionDescription, SurfaceList = new List<string> { "Item_1", "Item_2", "Item_3" } });
}
dataGridSection.ItemsSource = trackSection;
The XAML code for the SFGrid:
<sfgrid:SfDataGrid.Columns>
<sfgrid:GridNumericColumn IsHidden="False" MappingName="SectionID"/>
<sfgrid:GridNumericColumn IsHidden="False" MappingName="SectionTrackID"/>
<sfgrid:GridNumericColumn IsHidden="False" MappingName="SectionIncr"/>
<sfgrid:GridTextColumn AllowEditing="False" MappingName="SectionName" />
<sfgrid:GridTextColumn AllowEditing="False" MappingName="SectionDescription" />
<sfgrid:GridComboBoxColumn AllowEditing="True"
HeaderText="Surface"
MappingName="SurfaceList"/>
</sfgrid:SfDataGrid.Columns>
When running the code, I have the following error in the Column for the List:
Thanks for any advice and help :)
Markus