Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using TestMVVM.Notifications;
- namespace TestMVVM.ViewModels
- {
- class JournalViewModel : PropertyChangedNotification
- {
- #region Fields for binding
- public CommonViewModel Common
- {
- get { return GetValue(() => Common); }
- set { SetValue(() => Common, value); }
- }
- public ObservableCollection<BoreViewModel> Bores
- {
- get { return GetValue(() => Bores); }
- set { SetValue(() => Bores, value); }
- }
- public BoreViewModel ActiveBore
- {
- get { return GetValue(() => ActiveBore); }
- set { SetValue(() => ActiveBore, value); }
- }
- public bool IsInfoActive
- {
- get { return GetValue(() => IsInfoActive); }
- set { SetValue(() => IsInfoActive, value); }
- }
- #endregion
- public JournalViewModel(Journal journal)
- {
- Common = new CommonViewModel(journal.Common);
- Bores = new ObservableCollection<BoreViewModel>();
- var editCommand = new RelayCommand(o => ActivateBore((BoreViewModel)o));
- foreach (var bore in journal.Bores)
- Bores.Add(new BoreViewModel(bore, editCommand));
- }
- public void ActivateBore(BoreViewModel vm)
- {
- ActiveBore = vm;
- IsInfoActive = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement