Files
downkyicore/DownKyi/Views/ViewMyToViewVideo.axaml
2024-04-24 09:20:52 +08:00

275 lines
13 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="DownKyi.Views.ViewMyToViewVideo"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
xmlns:i="using:Avalonia.Xaml.Interactivity"
xmlns:custom="clr-namespace:DownKyi.CustomControl"
xmlns:ia="clr-namespace:Avalonia.Xaml.Interactions.Core;assembly=Avalonia.Xaml.Interactions"
xmlns:vm="clr-namespace:DownKyi.ViewModels"
xmlns:vmp="clr-namespace:DownKyi.ViewModels.PageViewModels"
x:DataType="vm:ViewMyToViewVideoViewModel">
<UserControl.Resources>
<ControlTheme x:Key="MediaListStyle" TargetType="{x:Type ListBoxItem}" x:DataType="vmp:ToViewMedia">
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid
Name="nameMediaPanel"
Height="100"
Margin="20,15,10,5" ColumnDefinitions="160,*">
<Border
Name="nameCover"
Grid.Column="0"
Width="160"
Height="100"
HorizontalAlignment="Center"
CornerRadius="5">
<Border.Background>
<!-- 长宽比1.6 -->
<ImageBrush Source="{Binding Cover}" />
</Border.Background>
</Border>
<Image
IsVisible="{Binding IsSelected}"
Name="nameChecked"
Grid.Column="0"
Width="24"
Height="24"
Margin="10"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Source="/Resources/checked.png" />
<StackPanel
Grid.Column="1"
Margin="20,0"
Orientation="Vertical">
<TextBlock
Name="NameTitle"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Cursor="Hand"
FontSize="14"
FontWeight="Bold"
Text="{Binding Title}"
TextTrimming="CharacterEllipsis"
ToolTip.Tip="{Binding Title}">
<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="PointerReleased">
<ia:InvokeCommandAction Command="{Binding TitleCommand}"
CommandParameter="{ReflectionBinding DataContext.PageName, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
</TextBlock>
<StackPanel
Name="NameUp"
Margin="0,40,0,0"
Cursor="Hand"
Orientation="Horizontal">
<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="PointerReleased">
<ia:InvokeCommandAction Command="{Binding UpCommand}"
CommandParameter="{ReflectionBinding DataContext.PageName, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" />
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
<Border
Width="24"
Height="24"
HorizontalAlignment="Center"
VerticalAlignment="Center"
CornerRadius="12">
<Border.Background>
<ImageBrush Source="{Binding UpHeader}" />
</Border.Background>
</Border>
<TextBlock
Name="nameUpName"
Margin="10,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding UpName}" />
</StackPanel>
</StackPanel>
<TextBlock
Grid.Column="1"
Height="1"
Margin="20,0,20,0"
VerticalAlignment="Bottom"
Background="{DynamicResource BrushBorderTranslucent}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style Selector="^ /template/ TextBlock#NameTitle:pointerover">
<Setter Property="Foreground" Value="{DynamicResource BrushPrimary}" />
</Style>
<Style Selector="^ /template/ StackPanel#NameUp:pointerover TextBlock#nameUpName">
<Setter Property="Foreground" Value="{DynamicResource BrushPrimary}" />
</Style>
</ControlTheme>
</UserControl.Resources>
<Grid RowDefinitions="50,1,*">
<Grid Grid.Row="0" ColumnDefinitions="100,*,100">
<Button
Grid.Column="0"
Margin="10,5,0,5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Command="{Binding BackSpaceCommand}"
Theme="{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 MyToView}" />
</StackPanel>
</Button>
<Button
Grid.Column="2"
Width="24"
Height="24"
Margin="10,5"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Command="{Binding DownloadManagerCommand}"
Theme="{StaticResource ImageBtnStyle}"
ToolTip.Tip="{DynamicResource DownloadManager}">
<ContentControl>
<Path
Width="{Binding DownloadManage.Width}"
Height="{Binding DownloadManage.Height}"
Data="{Binding DownloadManage.Data}"
Fill="{Binding DownloadManage.Fill}"
Stretch="Uniform" />
</ContentControl>
</Button>
</Grid>
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
<Grid Grid.Row="2" IsVisible="{Binding ContentVisibility}" RowDefinitions="*,1,50">
<ListBox
x:Name="NameMedias"
Grid.Row="0"
BorderThickness="0"
ItemContainerTheme="{StaticResource MediaListStyle}"
ItemsSource="{Binding Medias}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
SelectionMode="Multiple">
<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="SelectionChanged">
<ia:InvokeCommandAction Command="{Binding MediasCommand}"
CommandParameter="{Binding ElementName=NameMedias, Path=SelectedItems}" />
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.Theme>
<ControlTheme TargetType="{x:Type ListBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border
x:Name="Bd"
Padding="0"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Focusable="False">
<ItemsPresenter ItemsPanel="{TemplateBinding ItemsPanel}" />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</ControlTheme>
</ListBox.Theme>
</ListBox>
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorder}" />
<Grid Grid.Row="2" ColumnDefinitions="80,*,100,90">
<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}" />
<Button
Grid.Column="2"
Margin="0,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Command="{Binding AddToDownloadCommand}"
Content="{DynamicResource DownloadSelectedPublication}"
FontSize="12"
Foreground="{DynamicResource BrushText}"
Theme="{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}"
Theme="{StaticResource BtnStyle}" />
</Grid>
</Grid>
<!-- 加载gif -->
<StackPanel
Grid.Row="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Vertical"
IsVisible="{Binding LoadingVisibility}">
<custom:Loading
Width="40"
Height="40"
Foreground="Gray"
IsActive="{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="/Resources/no-data.png"
IsVisible="{Binding NoDataVisibility}" />
</Grid>
</UserControl>