- Home
- Forum
- Xamarin.Forms
- DisplayMemberPath value being used as SelectedValue?
DisplayMemberPath value being used as SelectedValue?
Hi, I have the following SfComboBox defined:
<comboBox:SfComboBox DataSource="{Binding SelectedPanel.DataSource}"
DisplayMemberPath="Item1"
SelectedValuePath="Item2" SelectedValue="{Binding SelectedPanel.SelectedValue}"/>
The DataSource is bound to a collection of Tuple<string, Enum>. The ComboBox is behaving correctly in that it displays the text value (Item1 of the Tuple) but a silend exception is thrown when changing the SelectedValue as an attempt is made to convert a string to the Enum value set as the target of the SelectedValue binding. It appears as if the combo box is ignoring the SelectedValuePath? Versions are below:
Syncfusion: 17.4.0.53
XF: 4.5.0.356
Android Emulator: 9.0 (API 28)
SIGN IN To post a reply.
3 Replies
SP
Sakthivel Palaniyappan
Syncfusion Team
March 5, 2020 12:26 PM UTC
Hi Peter,
Greetings from Syncfusion.
We have analyzed your query and created sample based on your provided code snippet , but we are unable to reproduce the reported issue. Please find the sample from below location.
Sample ink:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/ComboBoxSample999259946.zip
Since we are not aware of your exact application scenario, so we request you to try our sample and can you please revert us by modifying the sample based on your application along with replication procedure. This will be help us to investigate further and provide you with a better solution at the earliest.
Regards,
Sakthivel P.
Greetings from Syncfusion.
We have analyzed your query and created sample based on your provided code snippet , but we are unable to reproduce the reported issue. Please find the sample from below location.
Sample ink:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/ComboBoxSample999259946.zip
Since we are not aware of your exact application scenario, so we request you to try our sample and can you please revert us by modifying the sample based on your application along with replication procedure. This will be help us to investigate further and provide you with a better solution at the earliest.
Regards,
Sakthivel P.
PH
Peter Hedley
March 6, 2020 02:54 PM UTC
Please look at my code and your example carefully. In your example the SelectedValue is bound to an ObservableCollection - how can this be correct?? The purpose of me using the SelectedValuePath is to ensure that a particular property of the bound DataSource objects is set as the selected value and the target property is dictated by the binding in SelectedValue.
SP
Sakthivel Palaniyappan
Syncfusion Team
March 9, 2020 12:45 PM UTC
Hi Peter,
Sorry for the sample.
The purpose SelectedValuePath is used to get the particular property in DataSource. We have modified the sample based on your requirement, please find the sample from below location.
Sample link:
Sorry for the sample.
The purpose SelectedValuePath is used to get the particular property in DataSource. We have modified the sample based on your requirement, please find the sample from below location.
Sample link:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/ComboBoxSample-1763441299.zip
Please let us know if you have any concern.
Regards,
Sakthivel P.
Please let us know if you have any concern.
Regards,
Sakthivel P.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
PH Peter Hedley
- Mar 4, 2020 07:58 PM UTC
- Mar 9, 2020 12:45 PM UTC