193 lines
12 KiB
XML
193 lines
12 KiB
XML
<UserControl x:Class="GameCollections.Views.CollectionsHomeView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:local="clr-namespace:GameCollections.Views"
|
|
xmlns:vm="clr-namespace:GameCollections.ViewModels"
|
|
mc:Ignorable="d"
|
|
d:DataContext="{d:DesignInstance Type=vm:CollectionsHomeViewModel}"
|
|
d:DesignHeight="600" d:DesignWidth="900">
|
|
<UserControl.Resources>
|
|
<ResourceDictionary>
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="/GameCollections;component/Views/Styles.xaml" />
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
<ContextMenu x:Key="CardContextMenu" x:Shared="False">
|
|
<MenuItem Header="{DynamicResource LOCGameCollections_Open}" Command="{Binding OpenCommand}" FontWeight="SemiBold" />
|
|
<MenuItem Header="{DynamicResource LOCGameCollections_Edit}" Command="{Binding EditCommand}" InputGestureText="F2" />
|
|
<Separator />
|
|
<MenuItem Header="{DynamicResource LOCGameCollections_Delete}" Command="{Binding DeleteCommand}" InputGestureText="Del" />
|
|
</ContextMenu>
|
|
|
|
<Style x:Key="CardContainerStyle" TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
|
|
<Setter Property="ContextMenu" Value="{StaticResource CardContextMenu}" />
|
|
<Setter Property="Margin" Value="0,0,10,10" />
|
|
<Setter Property="Padding" Value="8" />
|
|
<Setter Property="Cursor" Value="Hand" />
|
|
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
|
<EventSetter Event="MouseLeftButtonUp" Handler="CardItem_MouseLeftButtonUp" />
|
|
</Style>
|
|
|
|
<Style x:Key="RowContainerStyle" TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
|
|
<Setter Property="ContextMenu" Value="{StaticResource CardContextMenu}" />
|
|
<Setter Property="Padding" Value="8,6" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
|
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
|
<EventSetter Event="MouseDoubleClick" Handler="RowItem_MouseDoubleClick" />
|
|
</Style>
|
|
|
|
<!-- Grid card: fixed size so every card lines up regardless of its content. -->
|
|
<DataTemplate x:Key="CardTemplate" DataType="{x:Type vm:CollectionCardViewModel}">
|
|
<StackPanel Width="170">
|
|
<local:PosterImage Width="170" Height="255" GlyphSize="56" Source="{Binding Poster}" />
|
|
<TextBlock Text="{Binding Title}" ToolTip="{Binding Title}"
|
|
Style="{StaticResource GcItemTitleText}" Margin="0,8,0,0" />
|
|
<TextBlock Text="{Binding Description}" Style="{StaticResource GcMutedText}"
|
|
FontSize="{DynamicResource FontSizeSmall}"
|
|
TextWrapping="Wrap" TextTrimming="CharacterEllipsis"
|
|
Height="32" Margin="0,3,0,0" />
|
|
<DockPanel Margin="0,6,0,0">
|
|
<TextBlock DockPanel.Dock="Right" Text="{Binding GameCountText}"
|
|
Style="{StaticResource GcMutedText}" FontSize="{DynamicResource FontSizeSmall}" />
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="" Style="{StaticResource GcGlyph}"
|
|
Foreground="{DynamicResource GlyphBrush}" Margin="0,0,4,0" />
|
|
<TextBlock Text="{Binding RatingText}" Style="{StaticResource GcText}"
|
|
FontSize="{DynamicResource FontSizeSmall}" />
|
|
</StackPanel>
|
|
</DockPanel>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
|
|
<!-- List row: compact, with inline actions. -->
|
|
<DataTemplate x:Key="RowTemplate" DataType="{x:Type vm:CollectionCardViewModel}">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="90" />
|
|
<ColumnDefinition Width="100" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<local:PosterImage Width="48" Height="72" GlyphSize="22" CornerRadius="3" Source="{Binding Poster}" />
|
|
<StackPanel Grid.Column="1" Margin="14,0,10,0" VerticalAlignment="Center">
|
|
<TextBlock Text="{Binding Title}" Style="{StaticResource GcItemTitleText}" />
|
|
<TextBlock Text="{Binding Description}" Style="{StaticResource GcMutedText}"
|
|
TextTrimming="CharacterEllipsis" Margin="0,3,0,0"
|
|
ToolTip="{Binding Description}"
|
|
Visibility="{Binding HasDescription, Converter={StaticResource BoolToVisibility}}" />
|
|
</StackPanel>
|
|
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
|
|
<TextBlock Text="" Style="{StaticResource GcGlyph}"
|
|
Foreground="{DynamicResource GlyphBrush}" Margin="0,0,5,0" />
|
|
<TextBlock Text="{Binding RatingText}" Style="{StaticResource GcText}" />
|
|
</StackPanel>
|
|
<TextBlock Grid.Column="3" Text="{Binding GameCountText}" Style="{StaticResource GcMutedText}"
|
|
VerticalAlignment="Center" />
|
|
<StackPanel Grid.Column="4" Orientation="Horizontal" VerticalAlignment="Center">
|
|
<Button Style="{StaticResource GcIconButton}" Content=""
|
|
Command="{Binding EditCommand}"
|
|
ToolTip="{DynamicResource LOCGameCollections_Edit}"
|
|
AutomationProperties.Name="{DynamicResource LOCGameCollections_Edit}" />
|
|
<Button Style="{StaticResource GcIconButton}" Content="" Margin="5,0,0,0"
|
|
Command="{Binding DeleteCommand}"
|
|
ToolTip="{DynamicResource LOCGameCollections_Delete}"
|
|
AutomationProperties.Name="{DynamicResource LOCGameCollections_Delete}" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ResourceDictionary>
|
|
</UserControl.Resources>
|
|
|
|
<DockPanel Margin="20,15,20,0">
|
|
<!-- Header -->
|
|
<Grid DockPanel.Dock="Top" Margin="0,0,0,15">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
|
<TextBlock Text="{DynamicResource LOCGameCollections_PageTitle}" Style="{StaticResource GcPageTitleText}" />
|
|
<TextBlock Text="{Binding CountText}" Style="{StaticResource GcMutedText}"
|
|
VerticalAlignment="Center" Margin="12,4,0,0" />
|
|
</StackPanel>
|
|
<local:SearchBox x:Name="SearchInput" Grid.Column="2" Width="260" Height="32" Margin="10,0,0,0"
|
|
Text="{Binding SearchText}"
|
|
Placeholder="{DynamicResource LOCGameCollections_SearchCollections}" />
|
|
<Button Grid.Column="3" Style="{StaticResource GcIconButton}" Height="32" Margin="10,0,0,0"
|
|
Content="{Binding ViewModeToggleGlyph}"
|
|
Command="{Binding ToggleViewModeCommand}"
|
|
ToolTip="{Binding ViewModeToggleTooltip}"
|
|
AutomationProperties.Name="{Binding ViewModeToggleTooltip}" />
|
|
<Button Grid.Column="4" Style="{StaticResource GcButton}" Height="32" Margin="10,0,0,0"
|
|
Command="{Binding CreateCollectionCommand}">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="" Style="{StaticResource GcGlyph}" Margin="0,0,6,0" />
|
|
<TextBlock Text="{DynamicResource LOCGameCollections_CreateCollection}" VerticalAlignment="Center" />
|
|
</StackPanel>
|
|
</Button>
|
|
</Grid>
|
|
|
|
<Grid>
|
|
<!-- Grid view -->
|
|
<ListBox x:Name="CardsList"
|
|
Style="{StaticResource GcPlainListBox}"
|
|
ItemsSource="{Binding CardsView}"
|
|
SelectedItem="{Binding SelectedCard}"
|
|
IsSynchronizedWithCurrentItem="False"
|
|
ItemTemplate="{StaticResource CardTemplate}"
|
|
ItemContainerStyle="{StaticResource CardContainerStyle}"
|
|
ScrollViewer.CanContentScroll="False"
|
|
KeyDown="Collections_KeyDown"
|
|
AutomationProperties.Name="{DynamicResource LOCGameCollections_PageTitle}"
|
|
Visibility="{Binding IsGridView, Converter={StaticResource BoolToVisibility}}">
|
|
<ListBox.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<WrapPanel Orientation="Horizontal" Margin="0,0,0,10" />
|
|
</ItemsPanelTemplate>
|
|
</ListBox.ItemsPanel>
|
|
</ListBox>
|
|
|
|
<!-- List view -->
|
|
<ListBox x:Name="RowsList"
|
|
Style="{StaticResource GcPlainListBox}"
|
|
ItemsSource="{Binding CardsView}"
|
|
SelectedItem="{Binding SelectedCard}"
|
|
IsSynchronizedWithCurrentItem="False"
|
|
ItemTemplate="{StaticResource RowTemplate}"
|
|
ItemContainerStyle="{StaticResource RowContainerStyle}"
|
|
HorizontalContentAlignment="Stretch"
|
|
VirtualizingPanel.IsVirtualizing="True"
|
|
VirtualizingPanel.ScrollUnit="Pixel"
|
|
KeyDown="Collections_KeyDown"
|
|
AutomationProperties.Name="{DynamicResource LOCGameCollections_PageTitle}"
|
|
Visibility="{Binding IsListView, Converter={StaticResource BoolToVisibility}}" />
|
|
|
|
<!-- Empty state: no collections at all -->
|
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" MaxWidth="420"
|
|
Visibility="{Binding IsEmpty, Converter={StaticResource BoolToVisibility}}">
|
|
<TextBlock Text="" Style="{StaticResource GcGlyph}" FontSize="64"
|
|
Foreground="{DynamicResource GlyphBrush}" Opacity="0.6"
|
|
HorizontalAlignment="Center" />
|
|
<TextBlock Text="{DynamicResource LOCGameCollections_EmptyTitle}" Style="{StaticResource GcText}"
|
|
FontSize="{DynamicResource FontSizeLarge}" HorizontalAlignment="Center" Margin="0,12,0,0" />
|
|
<TextBlock Text="{DynamicResource LOCGameCollections_EmptyDescription}" Style="{StaticResource GcMutedText}"
|
|
TextWrapping="Wrap" TextAlignment="Center" Margin="0,8,0,0" />
|
|
<Button Style="{StaticResource GcButton}" HorizontalAlignment="Center" Margin="0,16,0,0"
|
|
Command="{Binding CreateCollectionCommand}"
|
|
Content="{DynamicResource LOCGameCollections_CreateCollection}" />
|
|
</StackPanel>
|
|
|
|
<!-- Search matched nothing -->
|
|
<TextBlock Text="{Binding NoResultsText}" Style="{StaticResource GcMutedText}"
|
|
HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,40,0,0"
|
|
Visibility="{Binding HasNoResults, Converter={StaticResource BoolToVisibility}}" />
|
|
</Grid>
|
|
</DockPanel>
|
|
</UserControl>
|