Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using DevExpress.Xpf.Mvvm;
- using MMHLive.Helpers;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Controls;
- namespace MMHLive.ViewModels
- {
- public class AddContainerVM : NavigationViewModelBase
- {
- private ObservableCollection<UserControl> views = new ObservableCollection<UserControl>();
- public ObservableCollection<UserControl> Views
- {
- get { return views; }
- set
- {
- views = value;
- RaisePropertyChanged(() => Views);
- }
- }
- private UserControl currentView = new UserControl();
- public UserControl CurrentView
- {
- get
- {
- return currentView;
- }
- set
- {
- if((currentView as IAdd) != null)
- (currentView as IAdd).IsSelected = false;
- currentView = value;
- (currentView as IAdd).IsSelected = true;
- RaisePropertyChanged(() => CurrentView);
- RaisePropertyChanged(() => States);
- }
- }
- public ObservableCollection<IAdd> States
- {
- get
- {
- return new ObservableCollection<IAdd>(Views.Select(v =>
- {
- var temp = (v as IAdd);
- return new Add(){ Attempted = temp.Attempted, Field = temp.Field, IsSelected = temp.IsSelected, IsValid = temp.IsValid, Value = temp.Value };
- }));
- }
- }
- public AddContainerVM(ObservableCollection<UserControl> _views)
- {
- Views = _views;
- CurrentView = Views.First();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment