Enumeration properties in the Xomega Framework provide default filtering of the
Header objects for the possible values to exclude inactive ones (that are used for looking up items for existing values, but not for selecting in lists anymore), and to implement any cascading selection that is configured for the property.
You can, however, implement your own filter function and assign it to the
FilterFunc member of the enumeration property. The filter function accepts a
Header object as a parameter and returns a
true boolean value, if it matches the filter, and
false otherwise. You can use the
ID or a
Text of the
Header to filter individual items, or you can use the values of additional attributes to filter certain categories of the items. You can also invoke the default function
IsAllowed to add your filtering on top of the default behavior.
The following example shows how an operator property is assigned a custom filter function implemented as a lambda expression, which invokes the default filtering function first, and then checks if the value of the multivalue additional attribute, whose name is specified by a constant string, is equal to "1".
Code:
MyOperatorProperty.FilterFunc = hdr => MyOperatorProperty.IsAllowed(hdr) &&
hdr[Enumerations.Operators.Attributes.Multival] == "1";