- Home
- Forum
- Xamarin.Forms
- Is it possible to load a list of items into the combobox over an ObservableCollection in the SFDataGrid
Is it possible to load a list of items into the combobox over an ObservableCollection in the SFDataGrid
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 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
}
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" } });
}
{
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:
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: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
SIGN IN To post a reply.
3 Replies
MA
Markus
May 10, 2020 10:57 AM UTC
When I get the Records of the List from the DataGrid, it Shows me the items:
Hmm, how can I get the Items now correctly displayed?
KK
Karthikraja Kalaimani
Syncfusion Team
May 11, 2020 12:41 PM UTC
Hi Markus,
Currently, we are validating your requirement. we will validate and update your further details on or before 13th May 2020. We appreciate your patience until then.
Regards,
Karthik Raja
Currently, we are validating your requirement. we will validate and update your further details on or before 13th May 2020. We appreciate your patience until then.
Regards,
Karthik Raja
KK
Karthikraja Kalaimani
Syncfusion Team
May 13, 2020 12:51 PM UTC
Hi Markus,
Please refer the below UG to achieve your requirement.
UG link : https://help.syncfusion.com/xamarin/datagrid/column-types?cs-save-lang=1&cs-lang=xaml#collection-of-primitive-types-1
Regards,
Karthik Raja
Please refer the below UG to achieve your requirement.
UG link : https://help.syncfusion.com/xamarin/datagrid/column-types?cs-save-lang=1&cs-lang=xaml#collection-of-primitive-types-1
Regards,
Karthik Raja
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
MA Markus
- May 10, 2020 09:38 AM UTC
- May 13, 2020 12:51 PM UTC