Hello,
I'm facing a problem with CSLA .NET MVVM. Any help is appreciated.
My Model is as the following:
Forecast : BusinessBase<Forecast>
Forecasts : DynamicListBase<Forecast>
Sales : BusinessBase<Sales>
SalesList : DynamicListBase<Sales>
My ViewModel is as the following:
ForecastsVM : ViewModel<Forecasts>
ForecastVM : ViewModel<Forecast>
SalesListVM : ViewModel<SalesList>
SalesVM : ViewModel<Sales>
I have an additional file in the ViewModel which contains the following:
public class Elements
{
private SalesVM;
private ForecastsVM;
...
}
and then in SalesListVM, I have the following method:
public ObservableCollection<Elements> Elems
{
get
{
ObservableCollection<Elements> elems = new ObservableCollection<Elements>();
foreach(Sales item in Model) elems.Add(new Elements (new SalesVM(item)));
return elems;
}
}
I'm binding this collection to a GridView in the xaml file, but the problem is that when the user modifies a SalesVM element in this Grid, it doesn't call the DataPortal_Update method that is found in Sales ....Why?
Thanks
Ziad
Is this Silverlight or WPF?
The WPF datagrid control is broken, and doesn't perform the correct data binding behaviors like other datagrid controls. Because DynamicListBase is designed to react to standard data binding behaviors, this means it doesn't work with the Microsoft datagrid control in WPF...
Its Silverlight ! but its really wierd because in SalesVM the constructor is as the following
public SalesVM (Sales s)
{
Model = s;
}
Thx
Ziad
Does the datagrid bind to the DLB, or to a list of viewmodel objects?
The DLB will only act properly if it is the direct target of the binding. In other words, the datagrid must bind directly to the DynamicListBase object, or the list won't get the data binding events it uses to trigger its behaviors.
Thanks for your reply!
Now, I understand much better the DynamicListBase !
The Using CSLA 4: Creating Business Objects and Using CSLA 4: Data Access ebooks have extensive information on DLB (http://store.lhotka.net).
Copyright (c) Marimer LLC