Jump to: navigation, search

Changes


HowTo:Implement Custom Filtering

593 bytes added, 30 July
/* Persisting Filter Values */ rephrased some descriptions
== Persisting Filter Values ==
{{UnderConstructionStart}}
One of the drawbacks of this method of filtering, is the inability for the UI to 'remember' user inputs when compared they navigate away from the page. This is because this implementation of dynamic filters exists solely on the UI thread (that is, is defined in XAML only with no actual connection to the data, opposite to [[Property_Based_Content_Filters]], for example), which is the inability re-rendered according to remember user inputs when they navigate away from the xaml definition every time the pageis loaded. This section describes how to implement a limited solution to this issue, the limitation being that values can currently only be persisted during the 'session', and will be closed if are lost when the user closes the client.
This solution involves use of the StoreProfileParametersCommand to save a simple create key-value pair pairs (a simple list of items made up of a name and a value), which can then be read using the syntax: 'StoredProfileParameters[key]'. The StoreProfileParameterCommand accepts a CommandParameter with the format 'key=value', where 'key' represents the name of the key-value pair that can be used to reference it later (in the case below, '"name'"), and 'value' represents what string should be returned by referencing it (in this case, the Text attribute of the text field control).
When a user completes their input, we use the StoreProfileParametersCommand to create or update a key-value pair associated with a particular filter, instead of passively reading the value from the input as was done previously.
Furthermore, the associated StoredProfileParameter is fed back to the input control, so that it's value will be displayed if any value is setfor that particular key (ie. if a filter value has been created), it will be displayed on the input control. Otherwise, otherwise the input control will be reset when next loading the page, as was previously the case with dynamic filtering, whereas the StoredProfileParameter will be persisted, leading to a mismatch between the UI and filtering state.
<tabs>
<tab name="UWP">
<source lang = "xml">
<TextBox x:Name="NameInput" PlaceholderTextText="{Binding StoredProfileParameter[name]}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="LostFocus">
<core:InvokeCommandAction Command="{Binding StoreProfileParameterCommand}" CommandParameter="{Binding Text, ElementName=DateInputNameInput, Converter={StaticResource StringFormatConverter}, ConverterParameter='name={0}'}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
{{UnderConstructionEnd}}
[[Category:Client|Custom Filtering]][[Category:Filtering|Custom Filtering]][[Category:Styling|Custom Filtering]][[Category:WinX|Custom Filtering]][[Category:XAML|Implement Custom Filtering]][[Category:Xamarin|Custom Filtering]]
== Known Issues ==
696
edits