Dec 20, 2012 at 6:49 AM
Edited Dec 20, 2012 at 6:52 AM
The problem is: we have 2 subtypes of models. They all derived from base class Purchase and stored in one BindingList<Purchase>.
Our target - basket window in Master-Details style. User can see purchases in ListBox with different ItemTemplates for each subtype of Purchase (I.e. for goods - small control with quantity and name, for fuel - small control pump number, nozzle, fuel
type, volume etc). When user click on purchase at the right side we must show details about purchase. For goods - big control with quantity and name, for fuel - big complex control with pumps sheme and other data.
Solution from my view (biggest problem - i'm a C++ programmer and using C# and WPF for 4 months and i have a little knowledge how to use C# and WPF at its best):
1) StyleTrigger or DataTrigger or just a DataTemplate to select correct UserControl for ListBox.
2) To show correct Details i planned to use ContentControl, but in my test project i have problem with it.
//Somwhere inside OnCcommand handler
//In another OnCcommand handler
This code used in main window to show screens (sales, help,statistic). The problem is when i set ActiveViewModel first time everything works fine and . But when i try to change ActiveViewModel i get exception "No parameterless constructor defined
for this object". Looks like i'll get same problem when will try to implement Master-Details part.
Any suggestions how to do it in best way? We already thinking about StackPanel with two Views for goods and fuel purchase, hiding each other on item select. Is it ok?