<phone:PhoneApplicationPage.Resources> <DataTemplate x:Key="llsItem" > <StackPanel x:Name="spItem" HorizontalAlignment="Left" Orientation="Horizontal" > <TextBlock x:Name="tbName" Width="40" Height="40" Text="{Binding User_ContactID}" FontSize="15" Foreground="BlueViolet" ></TextBlock> <TextBlock x:Name="tbId" Width="30" Height="40" Text="{Binding Login_ID}" Foreground="White"></TextBlock> </StackPanel> </DataTemplate> <phone:PhoneApplicationPage.Resources> <phone:Pivot HorizontalAlignment="Left" Height="690" Title="Video Conference" VerticalAlignment="Top" Width="480" > <phone:PivotItem CacheMode="{x:Null}" Header="常用会议" > <Button Content="Button" HorizontalAlignment="Left" Height="510" VerticalAlignment="Top" Width="183" Click="Button_Click_1"/> </phone:PivotItem> <phone:PivotItem Height="510" CacheMode="{x:Null}" Header="联系人" Margin="12,28,-263,0"> <phone:LongListSelector Height="500" x:Name="llsContact" IsGroupingEnabled="True" ItemsSource="{Binding}" ItemTemplate="{StaticResource llsItem}" Margin="0,0,0,0"> </phone:LongListSelector> </phone:PivotItem> </phone:Pivot>
public MainPage() { InitializeComponent(); ServiceReference1.WebServiceSoapClient ws = new ServiceReference1.WebServiceSoapClient(); ws.FriendCompleted += ws_FriendCompleted; ws.FriendAsync(IsolatedStorageSettings.ApplicationSettings["uid"].ToString()); } void ws_FriendCompleted(object sender, ServiceReference1.FriendCompletedEventArgs e) { if (e.Error == null) { IEnumerable<XElement> lx = e.Result.Nodes[1].Descendants("Table1"); List<Model.User> lu = new List<Model.User>(); foreach (var item in lx) { lu.Add(new Model.User() { Login_ID = item.Element("Login_ID").Value, UserName = item.Element("UserName").Value, } ); } llsContact.ItemsSource = lu; } else MessageBox.Show("联系人列表载入失败" + e.Error.Message); }
运行后,看不到绑定的数据,求帮助???!!!!