I have a api that is giving json data! I have to set a datasource for the combobox these api.But i am not getting any data in combobox. Help me !
public InspectionForm ()
{
InitializeComponent();
getdata();
}
public async Task<IEnumerable<InspectionModel>> GetProcess()
{
var client = new HttpClient();
string result = await client.GetStringAsync(Url);
return JsonConvert.DeserializeObject<IEnumerable<InspectionModel>>(result);
}
public async void getdata()
{
ProcessPicker.DataSource = await GetProcess();
ProcessPicker.DisplayMemberPath = "Name";
ProcessPicker.BindingContext = await GetProcess();
}
this is xaml.cs code
this is xaml code for the picker
<Label
FontFamily="{StaticResource Montserrat-Medium}"
Margin="0,24,0,4"
HeightRequest="18"
FontSize="12"
Text="Process *"
TextColor="{DynamicResource Gray-800}" />
<border:SfBorder
BorderColor="{Binding Source={x:Reference ProcessPicker}, Path=IsFocused, Converter={StaticResource ColorConverter}, ConverterParameter=3}"
Style="{StaticResource BusinessFormBorderStyle}">
<combobox:SfComboBox
x:Name="ProcessPicker"
SelectedValue="{Binding Process, Mode=TwoWay}"
Style="{StaticResource ComboBoxStyle}"
Watermark="Choose Process"
VerticalOptions="CenterAndExpand" DataSource="">
<combobox:SfComboBox.DropDownButtonSettings>
<combobox:DropDownButtonSettings>
<combobox:DropDownButtonSettings.View>
<Label
FontFamily="{StaticResource FontIcons}"
FontSize="25"
HorizontalTextAlignment="Center"
Text="{StaticResource DropDownButtonIcon}"
TextColor="{DynamicResource Gray-600}"
VerticalTextAlignment="Center" />
</combobox:DropDownButtonSettings.View>
</combobox:DropDownButtonSettings>
</combobox:SfComboBox.DropDownButtonSettings>
</combobox:SfComboBox>
</border:SfBorder>