Databind to multiple ListBoxes in a TabControl


hi all!

i'm playing silverlight mvvm light , have basic question experts out there:

my layoutroot grid contains tabcontrol 3 tabitems (pages). in each tabitem/page have listbox want fill data 3 generic lists available viewmodel:

<sdk:tabcontrol grid.row="1" width="auto" height="400">           
     <sdk:tabitem header="search result 1">
            <grid>
                <grid.columndefinitions>
                    <columndefinition width="200"/>
                    <columndefinition width="auto"/>                       
                 </grid.columndefinitions>
                  
                  <listbox grid.column="1">                       
                  </listbox>
             </grid>               
     </sdk:tabitem>
     <sdk:tabitem header="search result 2">
 <!--listbox search result 2 here-->
     </sdk:tabitem>
     <sdk:tabitem header="search result 3">
 <!--listbox search result 3 here-->
     </sdk:tabitem>
</sdk:tabcontrol>

my viewmodel has these public properties gives me items want populate listboxes with:

  private observablecollection<eniroaktor> companylist;
        public observablecollection<eniroaktor> companylist
        {
            { return this.companylist; }
            private set
            {
                this.companylist = value;
                this.raisepropertychanged("companylist");
            }
        }

        private observablecollection<eniroaktor> categorylist;
        public observablecollection<eniroaktor> categorylist
        {
            { return this.categorylist; }
            private set
            {
                this.categorylist = value;
                this.raisepropertychanged("categorylist");
            }
        }

        private observablecollection<eniroaktor> othercompanylist;
        public observablecollection<eniroaktor> othercompanylist
        {
            { return this.othercompanylist; }
            private set
            {
                this.othercompanylist = value;
                this.raisepropertychanged("othercompanylist");
            }
        }

so how tag tabcontrol , listbox databind 3 different list available in viewmodel?

common approach not work you? companylist looks like:

<listbox itemssource={binding path=companylist} />



Silverlight  >  MVVM / ViewModel Pattern with Silverlight



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........