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