c# - Xamarin forms how to pass Entry value from one to class to another class List? -
i want pass inserted number value page inserting value page list , update listview new value.
here addcardpage xaml:
<entry x:name="cardnr" text="" completed="entry_completed" keyboard="numeric" /> here addcardpage xaml.cs method:
void entry_completed(object sender, eventargs e) {     var text = ((entry)sender).text; //cast sender access properties of entry     new cards { number = convert.toint64(text) }; } here cardspage class declared data:
public cardspage() {     initializecomponent();     base.title = "cards";     list<cards> cardslist = new list<cards>()     {         new cards { number=1234567891234567, name="dsffds m", expdate="17/08", security=123 },         new cards { number=9934567813535135, name="jason t", expdate="16/08", security=132 },         new cards { number=4468468484864567, name="carl s", expdate="17/01", security=987 },     };     listview.itemssource = cardslist;           addcard.gesturerecognizers.add(new tapgesturerecognizer         {             command = new command(() => onlabelclicked()),         });        }     private void onlabelclicked()     {         navigation.pushasync(new addcardpage());     } and cardspage xaml listview:
<listview x:name="listview">   <listview.footer>      <stacklayout padding="5,5" orientation="horizontal" >       <label x:name="addcard" text="add new card" fontsize="15" />     </stacklayout>   </listview.footer>   <listview.itemtemplate>     <datatemplate>       <viewcell>           <label text="{binding number}" fontsize="15" />       </viewcell>     </datatemplate>   </listview.itemtemplate> </listview> how pass inserted entry value page class list , update listview content?
in page want value change it's constructor accept value , pass value calling page.
eg:
class page1 {   private async void onsomeevent()   {      await navigation.pushasync(new page2("xyz"));   } }  class page2 {   public page2(string myvalue)   {   } } 
Comments
Post a Comment