Ich habe eine beobachtbare Sammlung, die aus einer SQLite-Datenbank gefüllt ist, die Daten werden dann in einer Listenansicht angezeigt. Ich möchte dies in eine semantische Ansicht mit Kopfzeilen ändern. Wie gruppiere ich die Objekte in der Sammlung?eine beobachtbare Sammlung für semantischen Zoom filtern
XAML Seite
<Page.Resources>
<vm:IngredientsCollection x:Key="Ingredient"/>
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<uwp:SwipeListView x:Name="IngredientList" ItemClick="ItemClicked" LayoutUpdated="ListUpdated" ItemsSource="{StaticResource Ingredient}" IsItemClickEnabled="True" SelectionMode="Single" ItemSwipe="ItemSwipe" ItemLeftBackground="#FF007575" KeyDown="DeleteKeyPressed" IsTabStop="True" Margin="0,0,0,-1">
<uwp:SwipeListView.ItemTemplate>
<DataTemplate>
<Grid>
<StackPanel Orientation="Vertical" HorizontalAlignment="Left">
<TextBlock Text="{Binding IngredientName}" FontSize="18" Margin="12,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBlock Text="{Binding IngredientCategory.CategoryName}" FontSize="16" Margin="12,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" />
</StackPanel>
</Grid>
</DataTemplate>
</uwp:SwipeListView.ItemTemplate>
<uwp:SwipeListView.ItemContainerStyle>
<Style TargetType="uwp:SwipeListViewItem">
<Setter Property="Height" Value="80"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Setter Property="BorderBrush" Value="#FF007575"/>
</Style>
</uwp:SwipeListView.ItemContainerStyle>
</uwp:SwipeListView>
</Grid>
beobachtbare Sammlung
public class IngredientsCollection : ObservableCollection<Ingredient>
{
public IngredientsCollection()
: base()
{
var db = new SQLiteConnection(new SQLitePlatformWinRT(), App.path);
var Ingredients = new List<Ingredient>();
Ingredients = db.GetAllWithChildren<Ingredient>().ToList();
foreach (var Ingredient in Ingredients)
{
Add(Ingredient);
}
}
Meinst du wie [dies] (http://stackoverflow.com/questions/38905921/listview-keep-listviewheaderitem-on-top)? – AVK
Ja, das ist die Art von was ich suche –