I have a Picker bounded to a ObservableCollection object. The items are populated from a web service (json data).
The picker displays the data correctly, but the SelectedItem doesn't work.
Here is my xaml code:
<Picker
ItemsSource="{Binding RatesTax}"
ItemDisplayBinding="{Binding Code}"
SelectedItem="{Binding SourceRate, Mode=TwoWay}">
</Picker>
RatesTax is an object of RatesView class
public class RatesView
{
public string Code
{
get; set;
}
public double TaxRate
{
get; set;
}
}
and this is the propertie
public ObservableCollection<RatesView> RatesTax { get; set; }
this is the sourceRate atribute
private RatesView sourceRate;
and the SourceRate properties
public RatesView SourceRate
{
set
{
if (sourceRate != value)
{
sourceRate = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SourceRate"));
}
}
get
{
return sourceRate;
}
}
I put a Break Point in SourceRate to see if it enters when I pick some data of the picker but it does not enter in the SourceRate procedure. I thinks SelectedItem="{Binding SourceRate} is not working as expected.
thak you for your time!