如何在windows phone 8中将friendlist绑定为longlistselector
本文关键字:friendlist 绑定 longlistselector 中将 windows phone | 更新日期: 2023-09-27 18:08:21
我在windows phone中制作一个应用程序聊天,我有一个类名GetFriendResponse
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RAMACHAT.Model
{
public class FriendInfo
{
public bool success { get; set; }
public int statusCode { get; set; }
public string message { get; set; }
public _user data { get; set; }
}
public class GetFriendResponse
{
public bool success { get; set; }
public int statusCode { get; set; }
public string message { get; set; }
public string _id { get; set; }
public List<_user> data { get; set; }
}
和class _user作为
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RAMACHAT.Model
{
public class _user
{
public string _id { get; set; }
public string username { get; set; }
public string avatar { get; set; }
public bool isOnline { get; set; }
public bool isFollow { get; set; }
}
}
}
现在我想让friendslist作为longlistselector当服务器响应用户friendslist
string result = await App.client.getAllFriends();
string resultHistory = await App.client.getChatHistory();
resultObject = JsonConvert.DeserializeObject<GetFriendResponse>(result);
var resultHistoryObject = JsonConvert.DeserializeObject<HistoryResponse>(resultHistory);
List<AlphaKeyGroup.AlphaKeyGroup1<_user>> DataSource = AlphaKeyGroup.AlphaKeyGroup1<_user>.CreateGroups(resultObject.data,
System.Threading.Thread.CurrentThread.CurrentUICulture,
(_user s) => { return s.username; }, true);
friendList.ItemsSource = DataSource;
但它不工作,谁有一个想法来修复它,谢谢这么多!
这可能是您的XAML页面绑定的问题,因为您没有共享设计代码块。