- Home
- Forum
- Xamarin.Forms
- SfDataGrid and ComboBox - Combobox will not open (complex datatype)
SfDataGrid and ComboBox - Combobox will not open (complex datatype)
Hi,
we want to select a value from ComboBox in a SFDataGrid. I tried it with GridComboboxColumn and GridTemplateColumn + Combobox but both are not selectable with my complex datatype KeyValue. It wont open if I tap on it. If I change the ObservableCollection<KeyValue> to ObservableCollection<string> the GridComboboxColumn is selectable but the GridTemplateColumn + Combobox isn't. How can I get it to work? We prefere the nested combobox instead of GridComboboxColumn because I can't tap out without selecting.
<sfgrid:SfDataGrid x:Name="dgAuftraege"
ItemsSource="{Binding Auftraege}"
AutoGenerateColumns="False"
ColumnSizer="Star"
AllowEditing="True"
SelectionMode="Single"
EditTapAction="OnTap"
NavigationMode="Cell">
<sfgrid:SfDataGrid.Columns>
<sfgrid:GridTextColumn HeaderText="Struktur" CellTextSize="15" MappingName="StrukturId" AllowEditing="False"/>
<sfgrid:GridTextColumn HeaderText="Auftrag" CellTextSize="15" MappingName="BelId" AllowEditing="False"/>
<sfgrid:GridTextColumn HeaderText="Bezeichnung" CellTextSize="15" MappingName="Matchcode" Width="350" AllowEditing="False"/>
<sfgrid:GridTextColumn HeaderText="Sollmenge" CellTextSize="15" MappingName="Sollmenge" AllowEditing="False"/>
<sfgrid:GridTextColumn HeaderText="Sollstarttermin" CellTextSize="15" MappingName="Sollendtermin" Format="dd.MM.yyyy" AllowEditing="False"/>
<sfgrid:GridTextColumn HeaderText="Sollendtermin" CellTextSize="15" MappingName="Sollendtermin" Format="dd.MM.yyyy" AllowEditing="False"/>
<sfgrid:GridTextColumn HeaderText="Projekt" CellTextSize="15" MappingName="Projekt" AllowEditing="False"/>
<sfgrid:GridComboBoxColumn MappingName="Value" BindingContext="{x:Reference viewModel}" ItemsSource="{Binding MitarbeiterList}" AllowEditing="True" />
<sfgrid:GridTemplateColumn MappingName="CustomerID" AllowEditing="True">
<sfgrid:GridTemplateColumn.CellTemplate>
<DataTemplate>
<combobox:SfComboBox HeightRequest="40" x:Name="comboBox" DataSource="{Binding MitarbeiterList}"/>
</DataTemplate>
</sfgrid:GridTemplateColumn.CellTemplate>
</sfgrid:GridTemplateColumn>
</sfgrid:SfDataGrid.Columns>
</sfgrid:SfDataGrid>
public ObservableCollection<KeyValue> MitarbeiterList { get; set; }
public AuftraegeZuweisenViewModel()
{
Auftraege = new ObservableRangeCollection<FaBeleg>();
MitarbeiterList = new ObservableCollection<KeyValue>();
foreach (var item in Settings.Current.MitarbeiterListe)
{
MitarbeiterList.Add(item.Value);
}
}
public class KeyValue
{
public string Key { get; set; }
public string Value { get; set; }
public KeyValue()
{
}
public KeyValue(string key, string value)
{
Key = key;
Value = value;
}
}
Thanks for your help!
Maria
SIGN IN To post a reply.
7 Replies
AN
Andy
March 10, 2020 08:04 AM UTC
Hi,
do you need further information in this case?
Regards,
Maria
AS
Anandraj Selvam
Syncfusion Team
March 10, 2020 01:45 PM UTC
Hi Maria,
Greetings from the Syncfusion.
Currently we are validating the reported query and we will update the complete details on or before 12th March 2020.
We appreciate your patience until then.
Regards,
Anand Raj S.
AS
Anandraj Selvam
Syncfusion Team
March 12, 2020 12:32 PM UTC
Hi Maria,
Thanks for your patience,
We would like to let you know that we have prepared a sample with the code snippet provided to check the reported issue, but we are not able to reproduce the issue at our end. Please find the sample from the below location.
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Datagrid_ComboBox-1466915482
Since we are not aware of your exact application scenario, could you please share the following details to check it further and provide a possible solution at earlier.
· Modifying the above-provided sample to replicate the issue
· If possible, can you please share the issue reproducing sample along with replication procedure.
Regards,
Anand Raj S.
AN
Andy
March 19, 2020 02:20 PM UTC
Hi all,
I've implented your example in my code and it works! Seems I have to set the DisplayMemberPath.
Thank you for your quick support!
Maria
DV
Divya Venkatesan
Syncfusion Team
March 20, 2020 07:12 AM UTC
Hi Maria,
Thanks for the update. We are glad to know that the given solution works.
Please get back to us if you need any further assistance.
Regards,
Divya Venkatesan
AN
Andy
March 20, 2020 07:28 AM UTC
Hi,
I have an other question :)
We want to enable multiple select on the combobox now. But it isn't enough space to show the selected items with tokens or delimeters. Is it possible to show the items like a list of checkbox items with multiple selection?
Thanks,
Maria
AS
Anandraj Selvam
Syncfusion Team
March 20, 2020 01:16 PM UTC
Hi Maria,
Thanks for the update.
Query 1: “But it isn't enough space to show the selected items with tokens or delimiters”
We have checked the reported query and we suggest you to wrap the Selected Items to the next line using the TokensWrapMode to Wrap. Please go through the below link for more details.
https://help.syncfusion.com/xamarin/combobox/multiple-selection?cs-save-lang=1&cs-lang=xaml#wrap-mode-of-token
Query 2: Is it possible to show the items like a list of checkbox items with multiple selection?
Currently, we don't have support for multiple selection in SfCombobox. We have already logged a feature request on this, and you can track the status of this feature implement through below link:
This feature implementation will be available in any of our upcoming releases.
We appreciate your patience until then.
Regards,
Anand Raj S.
SIGN IN To post a reply.
- 7 Replies
- 3 Participants
-
AN Andy
- Mar 5, 2020 01:38 PM UTC
- Mar 20, 2020 01:16 PM UTC