c# - Declaring a string variable to a Textblock in Windows Metro -


i might bit stupid asking question. have not found on net of yet problem. have windows app, listview displaying texblocks names in them , loaded xml file. here xaml code.

<listview x:name="listmyloans" rendertransformorigin="0.446,0.54"                                 margin="10,150,1052,10"                                 selectionchanged="listmyloans_selectionchanged_1"                                 grid.rowspan="2">         <listview.itemtemplate>             <datatemplate>                 <grid width="300" height="100" >                     <textblock x:name="tbtitle" text="{binding title}"></textblock >                     <textblock x:name="tbmediaindex" text="{binding mediaindex}"                                                       visibility="collapsed"/>                 </grid>             </datatemplate>         </listview.itemtemplate>     </listview> 

and need declare in code behind. string strmediaindex = tbmediaindex.text;

something not work, somehow not see textblock @ all.

thanks

you can use tag property, dont have declare 2 textbox. add new eventhandler textbox ontapped.

and in eventhandler can cast sender textbox. when cast it, can grab tag element , ready. simple , elegant if want use code-behind.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -