public SupplementsCycleWeekViewModel(SupplementsCycleDefinitionEditorViewModel parent, SupplementCycleWeekDTO week) { this.week = week; this.parent = parent; Dosages = new ObservableCollection <SupplementsCycleEntryViewModel>(); Image = "pack://application:,,,/BodyArchitect.Client.Module.Suplements;component/Resources/Week16.png"; foreach (var entry in week.Dosages.OfType <SupplementCycleDosageDTO>()) { Dosages.Add(new SupplementsCycleDosageViewModel(this, entry)); } foreach (var entry in week.Dosages.OfType <SupplementCycleMeasurementDTO>()) { Dosages.Add(new SupplementsCycleEntryViewModel(this, entry)); } }
public SupplementsCycleDefinitionEditorView() { InitializeComponent(); viewModel = new SupplementsCycleDefinitionEditorViewModel(); var binding = new Binding("IsModified"); binding.Mode = BindingMode.OneWay; SetBinding(IsModifiedProperty, binding); binding = new Binding("Header"); binding.Mode = BindingMode.OneWay; SetBinding(HeaderProperty, binding); DataContext = viewModel; }