/// <summary> /// Re-creates the list collection view that is used for the expression selection list. /// </summary> private void UpdateExpressionListItems(EvaluatableType t) { ListCollectionView lcv = new ListCollectionView(EvaluatableRegistry .Get(EvaluatableTypeResolver.Resolve(t)) // Get all condition types that match the required type .OrderBy(kvp => (int)kvp.Value.Category) // Order them by the numeric value of the category (so they appear in the order specified) .ThenBy(kvp => kvp.Value.Name) // Then, order the items alphabetically in their category .ToList()); lcv.GroupDescriptions.Add(new PropertyGroupDescription("Value.CategoryStr")); expressionSelection.ItemsSource = lcv; }
/// <summary> /// Creates a new OverrideDynamicValue for the specified type of property. /// <paramref name="type">The type of property being edited. E.G. for the "Enabled" property, the type will be `typeof(bool)`</paramref> /// </summary> public OverrideDynamicValue(Type type) { VarType = type; // Create a new set of constructor parameters by taking all the defined values in the typeDynamicDefMap for this type, then creating // a new instance of the default IEvaluatable for each parameter. E.G. for a parameter specified as EvaluatableType.Boolean, a new true // constant will be put in the constructor parameters dictionary. ConstructorParameters = typeDynamicDefMap.ContainsKey(type) ? typeDynamicDefMap[type].constructorParameters.ToDictionary(dcpd => dcpd.name, dcpd => EvaluatableTypeResolver.GetDefault(dcpd.type)) : null; }