Difference between revisions of "Property Based Content Filters"
Line 19: | Line 19: | ||
For performance/usability reasons, the result list is not immediately refreshed as one types in the text box. Instead, it only happens after the [[ReloadChildListCommand]] is triggered. | For performance/usability reasons, the result list is not immediately refreshed as one types in the text box. Instead, it only happens after the [[ReloadChildListCommand]] is triggered. | ||
− | {{Hint|The Borders in the example are not mandatory | + | {{Hint|The Borders in the example are not mandatory. They serve as indicators of whether a filter is currently applied on the result list. The PlaceHolderText is optional as well.}} |
[[Category:WinX|Property Based Content Filters]] | [[Category:WinX|Property Based Content Filters]] |
Revision as of 13:08, 18 May 2017
A collection of property-based content filtering criteria can be applied to child object lists. Some common use cases are as follows.
- A user can enter a text to reduce the entire child list to a sub list of those whose certain property display values contain that text;
- A customizer can create UI that presents several text input fields serving as such filters, with each applied to a different property.
For example. One can customize the ChildArea template to include the following.
<Grid>
<Border Background="#8000488E" Visibility="{Binding Children.Filters[SomePropertyName], Converter={StaticResource NullObjOrEmptyStrColConverter}}" />
<Border Background="#90707070" Visibility="{Binding Children.Filters[SomePropertyName], Converter={StaticResource NullObjOrEmptyStrVisConverter}}" />
<TextBox Text="{Binding Children.Filters[SomePropertyName], Mode=TwoWay, Converter={StaticResource FilterCriterionToValueConverter}}"
PlaceholderText="SomePropertyName" BorderThickness="0" Foreground="White" Background="Transparent" />
</Grid>
<Border Background="#8000488E" Visibility="{Binding Children.Filters[SomePropertyName], Converter={StaticResource NullObjOrEmptyStrColConverter}}" />
<Border Background="#90707070" Visibility="{Binding Children.Filters[SomePropertyName], Converter={StaticResource NullObjOrEmptyStrVisConverter}}" />
<TextBox Text="{Binding Children.Filters[SomePropertyName], Mode=TwoWay, Converter={StaticResource FilterCriterionToValueConverter}}"
PlaceholderText="SomePropertyName" BorderThickness="0" Foreground="White" Background="Transparent" />
</Grid>
This is shown as a single text box. The two way binding on Text allows the entered text (case insensitive) to be used as the filter value on property "SomePropertyName" (case sensitive).
For performance/usability reasons, the result list is not immediately refreshed as one types in the text box. Instead, it only happens after the ReloadChildListCommand is triggered.