public LoadViewModel(LoadView view) { SelectCommand = new DelegateCommand(Select); CloseCommand = new DelegateCommand(Close); DeleteCommand = new DelegateCommand(Delete); View = view; Groups = new ObservableCollection <GroupWithEditor>((DataContext.GetAll()).Select(t => new GroupWithEditor(t))); if (Groups != null && Groups.Count > 0) { SelectedGroup = Groups[0]; } }
public void Load() { LoadView lv = new LoadView(); lv.ShowDialog(); if (lv.DialogResult == true) { var x = (lv.DataContext as LoadViewModel).Groups.Where(t => t.IsSelected == true).ToList(); if (x != null && x.Count > 0) { this.Groups = new ObservableCollection <Group>(x.Select(t => t.ThisGroup)); //this.SelectGroup = Groups[0]; } } }