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/ViewChannel.xaml

311 lines
14 KiB

<UserControl
x:Class="DownKyi.Views.ViewChannel"
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}">
<StackPanel
Name="nameItemPanel"
Margin="15,15,10,5"
Cursor="Hand"
Orientation="Vertical">
<Border
Name="nameCover"
Width="190"
Height="119"
HorizontalAlignment="Center"
CornerRadius="5">
<Border.Background>
<!-- 长宽比1.6 -->
<ImageBrush ImageSource="{Binding Cover}" />
</Border.Background>
<Grid Width="190" Height="119">
<Image
Name="nameChecked"
Width="24"
Height="24"
Margin="0,10,15,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Source="/DownKyi;component/Resources/checked.png" />
<Border
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Background="{DynamicResource BrushMask}"
CornerRadius="5 0 5 0">
<TextBlock
Name="nameDuration"
Padding="6,0"
Foreground="{DynamicResource BrushText}"
Text="{Binding Duration}" />
</Border>
</Grid>
</Border>
<TextBlock
Name="nameTitle"
Height="35"
MaxWidth="190"
Margin="0,10,0,0"
Foreground="{DynamicResource BrushTextDark}"
Tag="{Binding Bvid}"
Text="{Binding Title}"
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap"
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 Margin="0,3,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Image
Width="11"
Height="11"
Source="/DownKyi;component/Resources/play.png" />
<TextBlock
Margin="5,0,0,0"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding PlayNumber}" />
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Image
Width="12"
Height="11"
Source="/DownKyi;component/Resources/time.png" />
<TextBlock
Margin="5,0,0,0"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding CreateTime}" />
</StackPanel>
</Grid>
</StackPanel>
<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="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="*" />
<ColumnDefinition Width="10" />
</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 Channel}" />
<TextBlock
VerticalAlignment="Center"
FontSize="16"
Foreground="{DynamicResource BrushTextDark}"
Text=" - ">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<DataTrigger Binding="{Binding Title}" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding Title}" Value="">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock
VerticalAlignment="Center"
FontSize="16"
Foreground="{DynamicResource BrushTextDark}"
Text="{Binding Title}" />
</StackPanel>
</Button>
</Grid>
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
<Grid Grid.Row="2">
<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 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="0"
Width="256"
Height="256"
Source="/DownKyi;component/Resources/no-data.png"
Visibility="{Binding NoDataVisibility}" />
<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>
</UserControl>