0
好吧我會做到這一點非常簡單!以下是的ViewModels:Silverlight Wcf Ria服務viewmodel組合框
public class ObjectsModel
{
public event PropertyChangedEventHandler PropertyChanged = delegate { };
private string _objectName;
public string ObjectName
{
get
{
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());
}
}
所以我想要做的就是我的第二個形式,我想補充的庫存對象,我必須選擇一個組合框的對象。問題是,我如何填充我的組合框?在InventoryModel中創建另一個「ObjectsModel」實例?或者使用另一個「上下文」來查詢另一個表?還是有更簡單的Xaml方法?如果我不清楚,告訴我我會放更多的例子/代碼。
tx很多!