Welcome to the Xamarin.Forms feedback portal. We’re happy you’re here! If you have feedback on how to improve the Xamarin.Forms, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
SelectedValuePath property is not working in conjunction with SelectedValue property.
SelectedValue binds to DisplayMemberPath value even if I set SelectedValue to some other property.
XAML
<comboBox:SfComboBox HeightRequest="40" DataSource="{Binding MaritalStatusCollection}" SelectedValue="{Binding SelectedValue, Mode=TwoWay}" DisplayMemberPath="Status" SelectedValuePath="Id" >
</comboBox:SfComboBox>
ViewModel
public class AddAssociatePageViewModel : BindableBase
{
private object _selectedValue;
public object SelectedValue
{
get { return _selectedValue; }
set { SetProperty(ref _selectedValue, value); }
}
private List<MaritalStatus> _maritalStatusCollection=new List<MaritalStatus>{new MaritalStatus{Id = 0,Status = "Single"}, new MaritalStatus { Id = 1, Status = "Married" }, new MaritalStatus { Id = 2, Status = "Divorced" } };
public List<MaritalStatus> MaritalStatusCollection
{
get { return _maritalStatusCollection; }
set { SetProperty(ref _maritalStatusCollection, value); }
}
public class MaritalStatus : BindableBase
{
public object Id { get; set; }
public string Status { get; set; }
}
}