Example #1
0
        private void AddQuestionTypeParam_Executed(object arg)
        {
            var param = new QuestionTypeParamViewModel();

            param.RemoveQuestionTypeParam.CanBeExecuted = AddQuestionTypeParam.CanBeExecuted;
            Params.Add(param);
        }
Example #2
0
        public void AddParam(string name, string value)
        {
            var param = new QuestionTypeParamViewModel(new QuestionTypeParam {
                Name = name, Value = value
            });

            param.RemoveQuestionTypeParam.CanBeExecuted = AddQuestionTypeParam.CanBeExecuted;
            Params.Add(param);
        }
Example #3
0
        public QuestionTypeViewModel(QuestionType model)
        {
            Model  = model;
            Params = new ObservableCollection <QuestionTypeParamViewModel>();

            Model.PropertyChanged += Model_PropertyChanged;

            AddQuestionTypeParam = new SimpleCommand(AddQuestionTypeParam_Executed)
            {
                CanBeExecuted = AddQuestionTypeParam_CanExecute()
            };

            foreach (var item in Model.Params)
            {
                var viewModel = new QuestionTypeParamViewModel(item)
                {
                    Owner = this
                };
                viewModel.RemoveQuestionTypeParam.CanBeExecuted = AddQuestionTypeParam.CanBeExecuted;
                Params.Add(viewModel);
            }

            Params.CollectionChanged += Params_CollectionChanged;
        }