Changes

Property Based Content Sorting

2,623 bytes added, 7 February
{{Hint|The Borders in the example are not mandatory. They merely highlight the currently active sorting header/button, which could be useful when multiple headers are displayed.}}
{{Category/Version|2.6.1}}
<br>
<br>
 
== Collection View sorting: UWP==
This functionality is documented in more detail on the wiki page [[Version 3.6 (WinX)]].
 
{{Attention| This only works for UWP! The section below shows how to achieve list sorting on Xamarin.}}
 
There is the possibility to sort at the point where you define your Collection View. This is especially useful for sorting Selective List items! An example is as follows:
<source lang = "xml">
xmlns:cv="using:UBIK.WinX.UI.CollectionView"
 
<cv:ListCollectionView x:Key="SortedList" ItemsSource="{Binding EditDialogViewModel.PropertyItem, Converter={StaticResource SelectiveListToItemsConverter}}">
<cv:ListCollectionView.SortDescriptions>
<cv:SortDescriptions>
<cv:SortDescription Direction="Ascending" PropertyName="Value" />
</cv:SortDescriptions>
</cv:ListCollectionView.SortDescriptions>
</cv:ListCollectionView>
</source>
 
{{Hint|This example can be found in the Lonza customising.}}
<br>
<br>
 
== ListView sorting: Xamarin ==
DataSource sorting works out of the box with SFListView! An example is as follows:
 
{{Attention| This only works for ValueItems (the sorting of selectable options in a list-type property pcker)! For sorting UBIK objects, use the Children.Sorting functionality described above, or make use of metaproperties like the GroupID and OrderID.}}
 
<source lang = "xml">
xmlns:controls="clr-namespace:UBIK.CPL.Controls;assembly=UBIK.CPL"
xmlns:dataSource="clr-namespace:Syncfusion.DataSource;assembly=Syncfusion.DataSource.Portable"
 
<controls:SfListViewExt
IsVisible="{Binding ShowComboBox}"
ItemsSource="{Binding PropertyItem, Mode=OneWay, Converter={StaticResource SelectiveListToItems}}"
SelectedItem="{Binding PropertyValue, Mode=TwoWay, Converter={StaticResource SelectiveItemToValue}, ConverterParameter={Binding Path=BindingContext, Source={x:Reference UBIKEditStringControl}}}"
SelectionMode="Single"
ItemSize="90"
Style="{DynamicResource SelectableListView}"
VerticalOptions="Center">
 
<controls:SfListViewExt.DataSource>
<dataSource:DataSource>
<dataSource:DataSource.SortDescriptors>
<dataSource:SortDescriptor Direction="Ascending" PropertyName="Value" />
</dataSource:DataSource.SortDescriptors>
</dataSource:DataSource>
</controls:SfListViewExt.DataSource>
</controls:SfListViewExt>
 
</source>
 
{{Hint|This example can be found in the Tyra customising.}}
 
== Troubleshooting ==
See [[Property_Based_Content_Filters#Troubleshooting|property based content filtering]].
 
[[Category:2.6.1|Property Based Content Sorting]]
[[Category:WinX|Property Based Content Sorting]]

Help improve this page!