c# - Longlist is not creating properly -
c# - Longlist is not creating properly -
i want populate longlist via wcf service. compilation goes without errors, result of executed programme looks 3 lines of this: phoneapp1.servicereference1.worker
instead of name , other info want display. service implementation is:
public ienumerable<worker> getstufflist() { list<worker> stufflist = new list<worker>(); stufflist.add(new worker("john", 23, true)); stufflist.add(new worker("nick", 22, true)); stufflist.add(new worker("gill", 23, false)); homecoming stufflist; } private list<group<worker>> getstuffenumerable() { ienumerable<worker> stufflist = getstufflist(); homecoming getitemgroups(stufflist, c => c.age.tostring()); } private static list<group<t>> getitemgroups<t>(ienumerable<t> itemlist, func<t, string> getkeyfunc) { ienumerable<group<t>> grouplist = item in itemlist grouping item getkeyfunc(item) g orderby g.key select new group<t>(g.key, g); homecoming grouplist.tolist(); } public class group<t> : list<t> { public group(string name, ienumerable<t> items) : base(items) { this.title = name; } public string title { get; set; } }
you need speficy itemtemplate longlistselector. without it, showing object.tostring().
something this:
<longlistselector ...> <longlistselector.itemtemplate> <datatemplate> <stackpanel> <textblock text="{binding name}"/> </stackpanel> </datatemplate> </longlistselector.itemtemplate> </longlistselector/>
c# wcf windows-phone-8 longlistselector
Comments
Post a Comment