不填充數據綁定所以我努力學習Silverlight的,所以我已經建立了一個簡單的演示應用程序,從FriendFeed拉我家的飼料,並顯示在列表中的項目。列表框在Silverlight 2
我有定義的列表框:
<ListBox x:Name="lstItems" Margin="5,61,5,5" Grid.Row="1">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="8,8,43,8">
<TextBlock Text="{Binding Title}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
正在由Web服務調用
private void LoginButton_Click(object sender, RoutedEventArgs e)
{
FriendFeedServiceClient client = new FriendFeedServiceClient();
client.GetHomeCompleted += new EventHandler<GetHomeCompletedEventArgs>(client_GetHomeCompleted);
client.GetHomeAsync(FfUsername.Text, FfApiKey.Password);
}
void client_GetHomeCompleted(object sender, GetHomeCompletedEventArgs e)
{
lstItems.DataContext = e.Result;
}
的FriendFeedServiceClient
正在做一個調用本地Web服務來代理請求填充實際的FriendFeed web服務。
服務調用工作正常,返回項目,如果我調試調用lstItems.DataContext
屬性填充其中的數據項目列表,但列表不顯示任何內容,它總是空白。我錯過了什麼嗎?
不幸的是,這並沒有改變任何東西。服務仍然響應數據,然後什麼都不做 – 2009-05-04 06:09:39