Silverlight Wcf Ria service viewmodel combobox -


ok i'll make simple! here viewmodels :

public class objectsmodel {     public event propertychangedeventhandler propertychanged = delegate { };      private string _objectname;     public string objectname     {                 {             return _objectname;         }         set         {             if (value != _objectname)             {                 _objectname = value;                 propertychanged(this, new propertychangedeventargs("objectname"));             }         }     }      public ienumerable<object> objects {get;set;}      public icommand addcommand { get; private set; }     public icommand savechangescommand { get; private set; }      mydomaincontext context = new mydomaincontext();     public objectsmodel()     {         objects = context.objects;         context.load(context.getobjectsquery());     }  }  public class inventorymodel {     public event propertychangedeventhandler propertychanged = delegate { };      public ienumerable<inventory> inventories {get;set;}      public icommand addcommand { get; private set; }     public icommand savechangescommand { get; private set; }      mydomaincontext context = new mydomaincontext();      public objectsmodel()     {         objects = context.objects;         context.load(context.getobjectsquery());     }  } 

so i'm trying in second form want add inventory object, have select object in combobox. question is, how fill combobox? create instance of "objectsmodel" in inventorymodel? or use "context" query other table? or there easier xaml approach? if i'm not clear, tell me i'll put more examples/code.

tx lot!

you want bind contents of combobox list of items provided viewmodel , bind selected item property on same viewmodel.

please habit of naming actual view models end in "viewmodel", rather "model", not clash other "real" models. looks binding directly business models instead of viewmodels (which not good).


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -