【问题标题】:How to binding friendlist as longlistselector in windows phone 8如何在 Windows Phone 8 中将好友列表绑定为 longlistselector
【发布时间】:2015-08-18 05:47:31
【问题描述】:

我在 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; }
    }

和类 _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; }

    }
}



    }

现在我想在服务器响应用户 frendslist 时将 frendslist 设为 longlistselector

 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; 

但它不起作用,任何人有解决它的想法,非常感谢!

【问题讨论】:

    标签: c# windows-phone-7 windows-phone-8 windows-phone-8.1 longlistselector


    【解决方案1】:

    这可能是您的 XAML 页面绑定问题,因为您没有共享设计代码块。 最好参考 this MSDN 页面进行 longlistselector 绑定。

    【讨论】:

      猜你喜欢
      • 2013-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-12
      • 1970-01-01
      • 2014-01-15
      • 2013-12-30
      相关资源
      最近更新 更多