Simple Master/Detail scenario with combobox/datagrid in Silverlight 4 -


i'm building series of admin forms part of application.

many of forms have same scenario, , i'm wondering best way manage is...

here's screenshot of example old winforms app. not of forms simple, figure it's place start.

the first field combo box. after user selects item, other fields populate associated data.

currently, viewmodel contains observablecollection<circuit> (for example). i'm not sure how set bindings, given master/detail scenario master (primary combobox) part of detail (circuitname field). thinking of pulling combobox out and, after selecting item, displaying datagrid. there better way? if go route, have read few articles indicate binding combobox inside datagrid, while property binding selectedvalue prop total pita. having combobox required user create/edit existing circuitname...

your thoughts?

i'm not sure understand, if using mvvm light, think are:) , wanted replicated screen above this. i'm not 100% understanding mean.

<grid x:name="layoutroot">     <grid.columndefinitions>         <columndefinition/>         <columndefinition/>     </grid.columndefinitions>     <grid.rowdefinitions>         <rowdefinition/>         <rowdefinition/>         <rowdefinition/>     </grid.rowdefinitions>      <stackpanel grid.columnspan="2">         <textblock text="circuit name"/>         <combobox selectedvalue="{binding selectedcircuit,mode=twoway}" itemssource="{binding circuits}" displaymemberpath="name"/>      </stackpanel>      <stackpanel grid.column="0" grid.row="1">         <textblock text="circuit code"/>         <textblock text="{binding selectedcircuit.code}"/>     </stackpanel>      <stackpanel grid.column="1" grid.row="1">         <textblock text="voltage"/>         <textblock text="{binding selectedcircuit.voltage}"/>     </stackpanel>      <button grid.row="2" content="okay"></button>     <button grid.row="2" grid.column="1" content="cancel"></button>  </grid> 

using system.collections.objectmodel; using galasoft.mvvmlight; using mvvmlight1.model;

namespace mvvmlight1.viewmodel {

public class mainviewmodel : viewmodelbase {      public mainviewmodel()     {          circuits = new observablecollection<circuit>                        {                            new circuit {code = "123123", name = "test1", voltage = 2.2, id = 1},                            new circuit {code = "14224", name = "test2", voltage = 3.2, id = 2},                            new circuit {code = "54234", name = "test3", voltage = 4.2, id = 3},                        };      }      public observablecollection<circuit> circuits { get; set; }      private circuit _selectedcircuit;     public circuit selectedcircuit     {         { return _selectedcircuit; }         set { _selectedcircuit = value;         raisepropertychanged("selectedcircuit");         }     } } 

}

namespace mvvmlight1.model {

public class circuit {     public int id { get; set; }      public string name { get; set; }      public string code { get; set; }      public double voltage { get; set; }  } 

}


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -