private void ScorerTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var dg = Locator.FindParent <DataGrid>(sender as DependencyObject);

            if (e.AddedItems.Count == 1 && (e.RemovedItems.Count == 0 || (e.RemovedItems.Count == 1 && e.AddedItems[0] != e.RemovedItems[0])))
            {
                ScorerType        scorerType = (ScorerType)(new ScorerEditorStringConverterExtension().ConvertBack(e.AddedItems[0], new ScorerType().GetType(), null, null));
                EditableCriterion ec         = dg.SelectedItem as EditableCriterion;

                ec.ScorerType = scorerType;
            }
        }
        public void EditableCriterion_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "Criterion":
            {
                EditableCriterion ec = sender as EditableCriterion;

                int index = orderedCriteria.IndexOf(ec);

                if (index == -1 || !ec.IsNewEditableCriterion)
                {
                    return;
                }

                // Finished editing a new Criterion - need to add it to the DecisionModel

                DecisionModel dm = DecisionModel;

                dm.CreateCriterion(
                    ec.Name,
                    ec.Description,
                    ec.Scorer);

                if (orderedCriteria.Count != 1)
                {
                    Criterion lastCriterion = dm.OrderedCriteria.Last.Value;
                    Criterion newCriterion  = dm.Criteria[ec.Name];

                    dm.CreateCriterionOrdering(
                        lastCriterion.Name,
                        CriterionOrdering.OrderingRelation.IsEqualTo,
                        newCriterion.Name);
                }

                dm.NormalizeCriteria();
                break;
            }

            case "Scorer":
            {
                EditableCriterion ec = sender as EditableCriterion;

                Scorer = ec.Scorer;
                break;
            }
            }
        }