Changes

HowTo:Implement Custom Filtering

214 bytes added, 14:38, 20 April 2023
The Filter Guid Editing is based on three four different xaml parts:
* Input field
* EvalExpression
* ListCollectionView * ListView <br>
<br>
With this Filter, we are able to filter in a Guid Editor dynamically without using any evaluate button or something, you just input a value that you want to filter with and it will directly output you any item that contains the filter input.
== Input field ==
The input field is just a basic Textbox we are gonna using for inputting the filter criteria value. <br>
It is based on these components:
* Grid.Resources to define the style
* Textblock with run text
* Textbox that serves as an input field
<br>
It will look like this:
<source lang = "xml">
<Grid>
<Grid.Resources>
<Style BasedOn="{StaticResource UBIKIconStyle}"
TargetType="FontIcon">
<Setter Property="Foreground"
Value="{StaticResource UBIKMediumTextColor}" />
<Setter Property="FontSize"
Value="14" />
<Setter Property="HorizontalAlignment"
Value="Left" />
</Style>
</Grid.Resources>
 
<!-- Type / Content / Buttons -->
<Grid.ColumnDefinitions>
<TextBlock Margin="0,0,0,0"
Grid.Column="0" Style="{StaticResource UBIKTextStyle}">
<Run Text="Name:"/>
</TextBlock>
<TextBox x:Name="InputTextboxName"
Grid.Column="1"
Margin="0,0,0,0" Style="{StaticResource UBIKTextBoxStyle}">
</TextBox>
</Grid>
The best solution would be to place this eval expression into the <Grid.Resources>.
 
Used namespace:
<source lang = "xml">
xmlns:controls="using:UBIK.WinX.Controls"
</source>
== [[XAML_Changes_in_UBIK_WinX_3.5#Filtering_by_expressions|ListCollectionView]] ==
<cv:ListCollectionView x:Key="FilterView"
Expression="{Binding ElementName=FilterExpression, Path=Result}"
ItemsSource="{Binding PropertyViewModel.FilterQueryResults.Items, Converter={StaticResource CollectionTruncateConverter}, ConverterParameter=200}"}" /></source>For the ItemsSource the original source can be any list of objects like Children.Items. Used namespace:<source lang = "xml">xmlns:cv="using:UBIK.WinX.UI.CollectionView"</source> == ListView control ==The ListView is for using the filtered results, in this example a SelectionBoundListView is used but could also be any other control list view.<source lang = "xml">controls:SelectionBoundListView x:Name="FilterQueryList" ItemTemplate="{Binding PropertyViewModel.TemplateService[UBIKInlineQueryResultItem]}" ItemsSource="{StaticResource FilterView}" SelectedValue="{Binding PropertyValue}" SelectedValuePath="UID" SelectionMode="Single"> </controls:SelectionBoundListView>
</source>
89
edits