Oi gente, estou com problemas para fazer um app onde, ao consultar o estado, aparecem apenas as cidades daquele estado, tudo usando Picker. O problema é: não sei como relacionar o código de busca com o picker. Alguém me ajudar?
using System;
using System.Collections.Generic;
using System.Net.Http;
using Xamarin.Forms;
using testeCEP.Modelos;
namespace testeCEP.Registros
{
public partial class Registro : ContentPage
{
public Registro()
{
InitializeComponent();
nomeCidade picker = new nomeCidade();
}
public async System.Threading.Tasks.Task<string> ConsultaEstado (object senders, EventArgs args)
{
HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync("https://servicodados.ibge.gov.br/api/v1/localidades/distritos?orderBy=nome");
response.EnsureSuccessStatusCode();
string nomeCidade = await response.Content.ReadAsStringAsync();
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="testeCEP.Registros.Registro">
<ContentPage.Content>
<StackLayout>
<Label Text="Registro" />
<Entry x:Name="nomeUser" Placeholder="Nome Completo" WidthRequest="200" Margin="7,0"/>
<Picker x:Name="nomeCidade" Margin="7,0" InputTransparent="True">
<Picker.Items>
<x:String>AC</x:String>
</Picker.Items>
</Picker>
</StackLayout>
</ContentPage.Content>
</ContentPage>