c# - access tab1 viewmodel data in tab2 viewmodel -


i want access values of tab 1 in tab 2 using code below that. problem don't know how use value of tab 1 property in tab 2.

xaml

<grid>         <tabcontrol>             <tabitem datacontext="{binding children[0]}" x:name="tab1" header="tab1" >                 <checkbox content="checkbox" height="16" horizontalalignment="left"   margin="176,132,0,0" name="checkbox1" verticalalignment="top"  commandparameter="{binding ischecked, relativesource={relativesource self}, mode=oneway}" command="{binding resetpassword}"                           />                 <!-- tab content -->             </tabitem>             <tabitem datacontext="{binding children[1]}" x:name="tab2" header="tab2" >                 <label content="{binding ischecked}"  ></label>                 <!-- tab content -->             </tabitem>         </tabcontrol>      </grid> 

mainviewmodel

class mainviewmodel {     observablecollection<object> _children; public mainviewmodel() {     _children = new observablecollection<object>();     _children.add(new tab1viewmodel());     _children.add(new tab2viewmodel()); }  public observablecollection<object> children { { return _children; } }  } 

in above demo trying use tab 1 checkbox value in tab 2 viewmodel , trying print on label in tab 2.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -