Changes

HowTo:Implement Custom Filtering

1,723 bytes added, 28 July
/* Filtering a DateTime Property */ Added xaml code on DateTime inputs
Filtering can be done as a simple comparison, such as finding an object whose date matches the inputted date. However, it is also possible to ranges; either 'open', that is, dates before or after the user's selection, or 'closed', which is a date falling inside a range created by two user inputs.
'''Input'''
* Freetext
* DatePicker
==== Input ====
The input method is the first important consideration for filtering DateTime properties. A DatePicker is the generally accepted method. Textbox input is also possible, though users will need to correctly format their input to 'yyyy/MM/dd' (such as "2032/12/31") in order to achieve a valid comparison.
'''Single ComparisonDatePicker'''<tabs><tab name="UWP"><source lang = "xml"><DatePicker x:Name="DatePicker" Tag="{Binding SelectedDate, ElementName=DatePicker, Converter={StaticResource StringFormatConverter}, ConverterParameter='{0:yyyy/MM/dd}'}" /></source></tab>
<tab name="Xamarin">
<source lang = "xml">
<DatePicker x:Name="DateInput" />
<Label x:Name="DateString" Text="{Binding Path=Date, Source={x:Reference DateInput}, StringFormat='{0:yyyy/MM/dd}'}"/>
</source>
</tab>
 
{{Attention|In both cases, it is necessary that the format of the input matches the format of the property value, which will be explained more in the section on filtering. In the above examples, this is applied in the Tag property (UWP) or through use of a secondary control (a Label in the Xamarin example).}}
</tabs>
 
 
'''Freetext'''
<tabs>
<tab name="UWP">
<source lang = "xml">
<TextBox x:Name="DateInput" PlaceholderText="Date"/>
</source>
</tab>
 
<tab name="Xamarin">
<source lang = "xml">
<Entry x:Name="DateInput" Placeholder="Date"/>
</source>
</tab>
 
{{Attention|Remember that no matches will be found unless the date is inputted following a 'yyyy/MM/dd' format.}}
</tabs>
 
 
==== Comparison ====
 
'''Single'''
Single comparison works the same way as other dynamic filters, that is, to compare an item's property value with user in, and filter an item in of a string match is found. For this purpose, it is sufficient to make use of the previously used .Contains() or .Equals() methods.
'''Open Range'''
696
edits