private void DeleteTypeData(TypeDataViewModel selected)
 {
     if (selected != null)
     {
         _currentCategoryModel.Remove(selected);
         _typeData.Remove(selected.Model);
         RegisterPendingChange(new DeleteTypeDataCommand(selected.Model, _type));
     }
 }
        void cmbCategory_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string category = cmbCategory.SelectedItem as string;

            if (category != null)
            {
                var list = _typeData.FindAll((info) => info.Category.Equals(category));
                _currentCategoryModel = new ObservableCollection <TypeDataViewModel>(list.Select((m) => {
                    var vm = new TypeDataViewModel(m);
                    return(vm);
                }));
                lstTypeData.ItemsSource = _currentCategoryModel;
            }
        }
        private void AddNewTypeData()
        {
            var model = new TypeData();

            model.Category    = cmbCategory.SelectedItem as string;
            model.Description = string.Format("<New {0} type>", _type);
            model.ID          = -1;
            var viewModel = new TypeDataViewModel(model);

            _currentCategoryModel.Add(viewModel);
            lstTypeData.SelectedItem = viewModel;

            lstTypeData.ScrollIntoView(viewModel);

            viewModel.IsRenaming = true;
            _typeData.Add(model);
            RegisterPendingChange(new InsertTypeDataCommand(model, _type));
        }
 private void RenameTraitType(TypeDataViewModel selected)
 {
     selected.IsRenaming = true;
 }