i have following model class
resultviewmodel public string word {get;set;} public list<string> meanings {get;set;}
with 2 properties . how can bind list of meanings string stack panel ?
my datas
word="a" , meanings= "a1","a2","a3"
word="b" , meanings= "b1","b2","b3"....
word="c" , meanings= "c1","c2","c3"....
i have following xaml me bind "a" "b" "c" etc want show meaning bottom
<itemscontrol name="lviewlookupresult" background="#363636"> <itemscontrol.itemtemplate> <datatemplate> <stackpanel orientation="horizontal" margin="5 5 5 0"> <label margin="5 0" padding="0" content="{binding word}" /> </stackpanel> <stackpanel orientation="vertical" margin="5 5 5 0"> ??????how can show meanings here??????????? </stackpanel> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol>
i using below code bind model , binding fine on run time
list<resultviewmodel> view_model = new list<resultviewmodel>(); lviewlookupresult.itemssource = view_model;
use itemscontrol
this:
<itemscontrol name="lviewlookupresult" background="#363636"> <itemscontrol.itemtemplate> <datatemplate> <stackpanel orientation="vertical"> <stackpanel orientation="horizontal" margin="5 5 5 0"> <label margin="5 0" padding="0" content="{binding word}" /> </stackpanel> <itemscontrol margin="5 5 5 0" itemssource="{binding meanings}"> <itemscontrol.itemtemplate> <datatemplate> <textblock text="{binding}"/> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </stackpanel> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol>
Comments
Post a Comment