Mercurial > silverbladetech
view delete me/SilverlightValidation/ViewModels/UserListViewModel.cs @ 66:b41cd0075c35
Third count added
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Sun, 22 Apr 2012 16:00:41 +0100 |
parents | 3591c26bd63e |
children |
line wrap: on
line source
using System.Collections.Generic; using System.Collections.ObjectModel; using System.Windows.Input; using SilverlightValidation.Commands; using SilverlightValidation.Models; using SilverlightValidation.Validators; namespace SilverlightValidation.ViewModels { public class UserListViewModel { public UserListViewModel(IList<UserModel> models, UserModelValidator validator) { Data = new ObservableCollection<UserViewModel>(); foreach (var model in models) Data.Add(new UserViewModel(model, validator)); AddCommand = new RelayCommand(AddCommandExecute); DeleteCommand = new RelayCommand(DeleteCommandExecute); } #region Properties public ObservableCollection<UserViewModel> Data { get; set; } public UserViewModel SelectedItem { get; set; } #endregion #region Commands public ICommand AddCommand { get; set; } public ICommand DeleteCommand { get; set; } private void AddCommandExecute(object obj) { } private void DeleteCommandExecute(object obj) { Data.Remove(SelectedItem); } #endregion } }