i want access value phonetextbox named "buttonsearch" placed inside listbox. problem can't invoke code behind. mean can easly this:
string writtentext = buttonsearch.text;
when phonetextbox not inside listbox.
mainpage.xaml:
<controls:panoramaitem name="panoramasearch"> <listbox itemssource="{binding apisearch}" name="listboxsearch"> <listbox.itemtemplate> <datatemplate> <stackpanel orientation="horizontal" x:name="panelsearch"> <toolkit:phonetextbox x:name="buttonsearch" hint="search" actionicon="images/search.png" height="70" width="350" actionicontapped="searchicontapped" /> <stackpanel orientation="horizontal"> <image height="100" width="100" source="{binding image}" /> <stackpanel width="311"> <textblock text="{binding title}" textwrapping="wrap" style="{staticresource phonetexttitle3style}" /> <textblock text="{binding category}" textwrapping="wrap" style="{staticresource phonetextsmallstyle}" /> </stackpanel> </stackpanel> </stackpanel> </datatemplate> </listbox.itemtemplate> </listbox> </controls:panoramaitem>
mainpage.xaml.cs:
private void searchicontapped(object sender, eventargs e) { //here place want phonetextboxvalue }
my problem can access listbox named listboxsearch. can't directly value phonetextbox. there way value?
thanks in advance.
create dependency property in mainpage.xaml.cs, let's call phonetext
.
in data template add phonetextbox:
text="{binding phonetext, relativesource={relativesource findancestor, ancestortype=page}, mode=twoway}"
then in code-behind:
private void searchicontapped(object sender, eventargs e) { var phonetxt = phonetext; //not necessary, show usage }
Comments
Post a Comment