0
我使用的是從REST服務獲取數據的AutocompleteBox控件。我的代碼看起來像這樣:AutoCompleteBox WindowsPhone
MODEL:
public class Word()
{
public int wordId {get;set}
public int wordName {get;set;}
}
XAML:
<toolkit:AutoCompleteBox x:Name="AutoDictionaryTB" Populating="AutoDictionaryTB_Populating_1" HorizontalAlignment="Left" Margin="63,10,0,0" Grid.Row="1" VerticalAlignment="Top" Width="383">
</toolkit:AutoCompleteBox>
後面的代碼:
private void AutoDictionaryTB_Populating_1(object sender, PopulatingEventArgs e)
{
var client = new RestClient("http://XXX.XXXX.XX");
var request = new RestRequest("/XXX.XXX.XX", Method.GET);
request.AddParameter("XX", "XX");
request.AddParameter("XX", "XX");
request.AddParameter("XXX", (sender as AutoCompleteBox).Text);
var response2 = client.ExecuteAsync<List<Word>>(request, response =>
{
if (response != null && response.Data != null)
{
AutoDictionaryTB.ItemsSource = response.Data;
AutoDictionaryTB.PopulateComplete();
}
else
{
MessageBox.Show("Unknow error occured. Check your Internet connection or try later.");
}
});
}
在該行:
AutoDictionaryTB.ItemsSource = response.Data;
我有我需要的所有服務,所以服務工作完美。爲什麼控制不顯示這些價值?雖然回答是空的。數據充滿了單詞。