You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
downkyi/DownKyi/Views/ViewMyFavorites.xaml

373 lines
18 KiB

<UserControl
x:Class="DownKyi.Views.ViewMyFavorites"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:custom="clr-namespace:DownKyi.CustomControl"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True">
<UserControl.Resources>
<Style x:Key="MediaListStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid
Name="nameMediaPanel"
Width="190"
Margin="15,15,10,5">
<Grid.RowDefinitions>
<RowDefinition Height="115" />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Border
Name="nameCover"
Grid.Row="0"
Width="185"
Height="115"
HorizontalAlignment="Center"
CornerRadius="5">
<Border.Background>
<!-- 长宽比1.6 -->
<ImageBrush ImageSource="{Binding Cover}" />
</Border.Background>
<Border
Name="nameInfoPanel"
Background="{DynamicResource BrushMask}"
CornerRadius="5"
Visibility="Hidden">
<StackPanel Margin="20,0,0,0" VerticalAlignment="Center">
<StackPanel Height="20" Orientation="Horizontal">
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushText}"
Text="{DynamicResource FavoritesPlayNumber}" />
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushText}"
Text="{Binding PlayNumber}" />
</StackPanel>
<StackPanel Height="20" Orientation="Horizontal">
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushText}"
Text="{DynamicResource FavoritesFavoriteNumber}" />
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushText}"
Text="{Binding FavoriteNumber}" />
</StackPanel>
<StackPanel Height="20" Orientation="Horizontal">
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushText}"
Text="{DynamicResource FavoritesUpName}" />
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushText}"
Text="{Binding UpName}" />
</StackPanel>
<StackPanel Height="20" Orientation="Horizontal">
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushText}"
Text="{DynamicResource FavoritesCreateTime}" />
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushText}"
Text="{Binding CreateTime}" />
</StackPanel>
</StackPanel>
</Border>
</Border>
<Image
Name="nameChecked"
Grid.Row="0"
Width="24"
Height="24"
Margin="0,10,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Source="/DownKyi;component/Resources/checked.png" />
<TextBlock
Name="nameTitle"
Grid.Row="1"
Width="185"
Height="35"
Margin="0,5"
Cursor="Hand"
Foreground="{DynamicResource BrushTextDark}"
Text="{Binding Title}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWithOverflow"
ToolTip="{Binding Title}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding TitleCommand}" CommandParameter="{Binding DataContext.PageName, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBlock>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{DynamicResource FavoritesFavTime}" />
<TextBlock
FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding FavTime}" />
</StackPanel>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="nameChecked" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter TargetName="nameChecked" Property="Visibility" Value="Hidden" />
</Trigger>
<Trigger SourceName="nameCover" Property="IsMouseOver" Value="True">
<Setter TargetName="nameInfoPanel" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger SourceName="nameTitle" Property="IsMouseOver" Value="True">
<Setter TargetName="nameTitle" Property="Foreground" Value="{DynamicResource BrushPrimary}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="1" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="0"
Margin="10,5,0,5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Command="{Binding BackSpaceCommand}"
Style="{StaticResource ImageBtnStyle}">
<StackPanel Orientation="Horizontal">
<ContentControl Width="24" Height="24">
<Path
Width="{Binding ArrowBack.Width}"
Height="{Binding ArrowBack.Height}"
Data="{Binding ArrowBack.Data}"
Fill="{Binding ArrowBack.Fill}"
Stretch="None" />
</ContentControl>
<TextBlock
VerticalAlignment="Center"
FontSize="16"
Foreground="{DynamicResource BrushTextDark}"
Text="{DynamicResource PublicFavorites}" />
</StackPanel>
</Button>
</Grid>
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
<Grid Grid.Row="2" Visibility="{Binding ContentVisibility}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- 左侧tab header -->
<ListBox
Name="nameLeftTabHeaders"
Grid.Column="0"
BorderThickness="0"
IsEnabled="{Binding IsEnabled}"
ItemContainerStyle="{StaticResource LeftTabHeaderItemStyle}"
ItemsSource="{Binding TabHeaders}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
SelectedIndex="{Binding SelectTabId, Mode=TwoWay}"
Style="{StaticResource LeftTabHeaderStyle}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding LeftTabHeadersCommand}" CommandParameter="{Binding ElementName=nameLeftTabHeaders, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ListBox>
<Grid Name="nameMediaPanel" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="1" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<ListBox
x:Name="nameMedias"
Grid.Row="0"
BorderThickness="0"
ItemContainerStyle="{StaticResource MediaListStyle}"
ItemsSource="{Binding Medias}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
SelectionMode="Extended">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding MediasCommand}" CommandParameter="{Binding ElementName=nameMedias, Path=SelectedItems}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.Style>
<Style TargetType="ListBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border
x:Name="Bd"
Padding="0"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Focusable="False">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.Style>
</ListBox>
<!-- 加载gif -->
<StackPanel
Grid.Row="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Vertical"
Visibility="{Binding MediaLoadingVisibility}">
<ContentControl
Width="40"
Height="40"
Content="{Binding MediaLoading}" />
</StackPanel>
<!-- 没有数据提示 -->
<Image
Grid.Row="0"
Width="256"
Height="256"
Source="/DownKyi;component/Resources/no-data.png"
Visibility="{Binding MediaNoDataVisibility}" />
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="80" />
</Grid.ColumnDefinitions>
<CheckBox
Grid.Column="0"
Margin="10,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Command="{Binding SelectAllCommand}"
CommandParameter="{Binding ElementName=nameMedias, Path=SelectedItem}"
Content="{DynamicResource SelectAll}"
Foreground="{DynamicResource BrushTextDark}"
IsChecked="{Binding IsSelectAll, Mode=TwoWay}"
Style="{StaticResource CheckBoxStyle}" />
<custom:CustomPager
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
DataContext="{Binding Pager}" />
<Button
Grid.Column="2"
Margin="0,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Command="{Binding AddToDownloadCommand}"
Content="{DynamicResource DownloadSelectedPublication}"
FontSize="12"
Foreground="{DynamicResource BrushText}"
Style="{StaticResource BtnStyle}" />
<Button
Grid.Column="3"
Margin="0,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Command="{Binding AddAllToDownloadCommand}"
Content="{DynamicResource DownloadAllPublication}"
FontSize="12"
Foreground="{DynamicResource BrushText}"
Style="{StaticResource BtnStyle}" />
</Grid>
</Grid>
</Grid>
<!-- 加载gif -->
<StackPanel
Grid.Row="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Vertical"
Visibility="{Binding LoadingVisibility}">
<ContentControl
Width="40"
Height="40"
Content="{Binding Loading}" />
<TextBlock
Margin="0,10,0,0"
FontSize="14"
Foreground="{DynamicResource BrushTextDark}"
Text="{DynamicResource PublicationWait}" />
</StackPanel>
<!-- 没有数据提示 -->
<Image
Grid.Row="2"
Width="256"
Height="256"
Source="/DownKyi;component/Resources/no-data.png"
Visibility="{Binding NoDataVisibility}" />
</Grid>
</UserControl>