Jump to: navigation, search

Changes


Property Based Content Filters

1,108 bytes added, 15:00, 13 July 2021
* ClearPropertyFilters: Clear out all existing filters at the current level before executing the command. This is optional and defaults to false;
* All other parameters: Used as filter criteria where the Keys are the names of the properties by which you want to filter.
 
 
By default, the expression used for filtering is Content["PROPERTY_NAME"].DisplayValue.ToLower().Contains(FILTER_VALUE.ToLower())==true. In other words, it checks whether the specified filter value (as string) is contained in the display value of the property.
In more advanced scenarios where a different type of comparison is needed, the example (or more specifically the one KeyValueParameter) can be extended into the following, e.g. comparing whether the specified filter value is equal to the value of the property.
<source lang = "xml">
<classes:KeyValueParameter Key="STA" Value="{Binding Path=SelectedItem.UID, Source={x:Reference Filter}, Converter={StaticResource FilterValueToCriterion}, ConverterParameter=Content[\&quot;\{0\}\&quot;].Value.Equals(\&quot;\{1\}\&quot;)}" />
</source>
{{Hint|"&amp;quot;" and "\" are used for escaping the special characters in XAML and C# code respectively. "{0}" and "{1}" are placeholders and get replaced by the property name and the filter value. The end expression being executed in this example is Content["PROPERTY_NAME"].Value..Equals(FILTER_VALUE).}}
{{Category/Version|2.6.1}}