ListBox control for Windows Phone development

Source: Internet
Author: User
Front-end Page code:
<! -- Data list start --> <scrollviewer horizontalscrollbarvisibility = "Auto" borderbrush = "white" borderthickness = "1" margin = "0,120, 450 "> <stackpanel Height =" "> <! -- <Border borderbrush = "gray" borderthickness = "1"> --> <grid margin = ", 0,"> <grid. columndefinitions> <columndefinition minwidth = "130" width = "130" maxwidth = "150"/> <columndefinition minwidth = "150" width = "150" maxwidth = "200"/> <columndefinition minwidth = "150" width = "150" maxwidth = "200"/> <columndefinition minwidth = "200" width = "250" maxwidth = "400"/> </ grid. columndefinitions> <border borderbrush = "Gra Y "borderthickness =" 1 "grid. column = "0"> <textblock grid. column = "0" horizontalalignment = "center" text = "customer name"> </textblock> </Border> <border borderbrush = "gray" borderthickness = "1" grid. column = "1"> <textblock grid. column = "1" horizontalalignment = "center" text = "landline"> </textblock> </Border> <border borderbrush = "gray" borderthickness = "1" grid. column = "2"> <textblock grid. column = "2" horizontalalignment = "CE Nter "text =" Mobile Phone "> </textblock> </Border> <border borderbrush =" gray "borderthickness =" 1 "grid. column = "3"> <textblock grid. column = "3" horizontalalignment = "center" text = "Address"> </textblock> </Border> </GRID> <! -- </Border> --> <ListBox X: Name = "listbox1" Height = "415" itemssource = "{binding}" margin =, 0, 0 "verticalignment =" TOP "selectionchanged =" listbox#selectionchanged "issynchronizedwithcurrentitem =" {X: NULL} "> <ListBox. itemtemplate> <datatemplate> <grid Height = "30" margin = "5, 0, 0, 2"> <grid. columndefinitions> <columndefinition minwidth = "130" width = "130" maxwidth = "150"/> <columndefinition minwidth = "150" Width = "150" maxwidth = "200"/> <columndefinition minwidth = "150" width = "150" maxwidth = "200"/> <columndefinition minwidth = "200" width = ""250" maxwidth = "400"/> </grid. columndefinitions> <border borderbrush = "gray" borderthickness = "1" grid. column = "0"> <textblock grid. column = "0" text = "{binding khmc}"> </textblock> </Border> <border borderbrush = "gray" borderthickness = "1" grid. column = "1"> 

Bound data list:

List <khmodel> lT = new list <khmodel> (); var khlist = from userdata in xele. descendants ("row") Select userdata; foreach (VAR khitem in khlist) {khmodel kh = new khmodel (); Kh. khbh = khitem. element ("khbh "). value; Kh. ssgsbh = khitem. element ("ssgsbh "). value; Kh. khmc = khitem. element ("XM "). value; Kh. gddh = khitem. element ("gddh "). value; Kh. yddh = khitem. element ("yddh "). value; Kh. DZ = khitem. element ("DZ "). value; lt. add (kH) ;}listbox1.itemssource = lt; // entity class public class khmodel {Public String khbh {Get; Set ;}public string ssgsbh {Get; set ;} public String khmc {Get; set;} Public String gddh {Get; set;} Public String yddh {Get; set;} Public String DZ {Get; set ;}}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.