wpf - Geting user input from listview -
i created listview. need user's input textbox inside listview. when user click on submit button user input listview displayed in messagebox. how user input textbox inside listview
<listview x:name="lstvqualification" height="96" margin="10,6,14,0" verticalalignment="top"> <listview.view> <gridview> <gridviewcolumn width="249" header="education"> <gridviewcolumn.celltemplate> <datatemplate> <stackpanel orientation="horizontal"> <textbox x:name="txteducation" width="247" text="{binding education}" /> </stackpanel> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn> <gridviewcolumn width="253" header="college/institution"> <gridviewcolumn.celltemplate> <datatemplate> <stackpanel orientation="horizontal"> <textbox x:name="txtcollege" width="251" text="{binding college}" /> </stackpanel> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn> <gridviewcolumn width="88" header="mark(%)"> <gridviewcolumn.celltemplate> <datatemplate> <stackpanel orientation="horizontal"> <textbox x:name="txtmark" width="86" text="{binding mark}" /> </stackpanel> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn> <gridviewcolumn width="88" header="add"> <gridviewcolumn.celltemplate> <datatemplate> <stackpanel orientation="horizontal"> <button x:name="btnaddqualification" click="btnaddqualification_click" content="add" style="{staticresource newimg}" /> </stackpanel> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn> </gridview> </listview.view> </listview> <button content="submit" x:name="submit" />
you use {binding ...}
everywhere in cell templates, bindings twoway default, user input would/should automatically passed underlying data objects. however, don't see binding on listview.itemssource
property, forgot prepare dataobjects. create collection of dataitems, bind them itemssource, let listview display them , celltemplates bindings should update dataitems' properties no work side. when submit
pressed, check collection of dataitems, data entered should there (assuming made models , bindings properly).
Comments
Post a Comment