mirror of
https://github.com/unclshura/splitter.git
synced 2026-06-22 00:22:01 +00:00
Multiselection added to FileListView
This commit is contained in:
parent
3f1924a429
commit
ad418e18a9
@ -8,6 +8,7 @@ public partial class FileListViewModel : ObservableObject
|
|||||||
{
|
{
|
||||||
private readonly IFileJobFactory _factory;
|
private readonly IFileJobFactory _factory;
|
||||||
public ObservableCollection<FileJobViewModel> Files { get; } = [];
|
public ObservableCollection<FileJobViewModel> Files { get; } = [];
|
||||||
|
public ObservableCollection<FileJobViewModel> SelectedFiles { get; } = [];
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private FileJobViewModel? _selected;
|
private FileJobViewModel? _selected;
|
||||||
|
|||||||
@ -12,11 +12,11 @@
|
|||||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||||
<Setter Property="BorderThickness" Value="0"/>
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="views|FileListView[IsDragActive=true] Border#DropZone">
|
<Style Selector="views|FileListView[IsDragActive=true] Border#DropZone">
|
||||||
<Setter Property="BorderBrush" Value="Red"/>
|
<Setter Property="BorderBrush" Value="Red"/>
|
||||||
<Setter Property="BorderThickness" Value="2"/>
|
<Setter Property="BorderThickness" Value="2"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
</UserControl.Styles>
|
</UserControl.Styles>
|
||||||
|
|
||||||
<Border x:Name="DropZone"
|
<Border x:Name="DropZone"
|
||||||
@ -28,34 +28,49 @@
|
|||||||
DragDrop.DragEnter="OnDragEnter"
|
DragDrop.DragEnter="OnDragEnter"
|
||||||
DragDrop.DragLeave="OnDragLeave">
|
DragDrop.DragLeave="OnDragLeave">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<ItemsControl ItemsSource="{Binding Files}">
|
<ListBox ItemsSource="{Binding Files}"
|
||||||
<ItemsControl.ItemsPanel>
|
SelectedItems="{Binding SelectedFiles}"
|
||||||
|
SelectedItem="{Binding Selected}"
|
||||||
|
SelectionMode="Multiple"
|
||||||
|
BorderThickness="0"
|
||||||
|
Background="Transparent">
|
||||||
|
|
||||||
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<WrapPanel Orientation="Horizontal"/>
|
<WrapPanel Orientation="Horizontal"/>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ItemsControl.ItemsPanel>
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
<ItemsControl.ItemTemplate>
|
<ListBox.Styles>
|
||||||
|
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
|
||||||
|
<Setter Property="Background" Value="#9A9A9A"/>
|
||||||
|
</Style>
|
||||||
|
</ListBox.Styles>
|
||||||
|
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate x:DataType="vm:FileJobViewModel">
|
<DataTemplate x:DataType="vm:FileJobViewModel">
|
||||||
<Border Margin="6" Padding="6" Background="#2A2A2A" CornerRadius="4">
|
<Border x:Name="ItemRoot"
|
||||||
|
Margin="0"
|
||||||
|
Padding="0"
|
||||||
|
CornerRadius="4"
|
||||||
|
Background="#2A2A2A">
|
||||||
<StackPanel MinWidth="160" MaxWidth="160">
|
<StackPanel MinWidth="160" MaxWidth="160">
|
||||||
|
|
||||||
<Border Width="160" Height="90" ClipToBounds="True">
|
<Border Width="160" Height="90" ClipToBounds="True">
|
||||||
<Grid>
|
<Grid>
|
||||||
<!-- Thumbnail -->
|
|
||||||
<Image Source="{Binding Thumbnail}"
|
<Image Source="{Binding Thumbnail}"
|
||||||
Stretch="UniformToFill"
|
Stretch="UniformToFill"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
<!-- Suggested action decal -->
|
<TextBlock FontFamily="{StaticResource FontAwesome}"
|
||||||
<TextBlock
|
Text="{Binding SuggestedAction, Converter={StaticResource ActionToIconConverter}}"
|
||||||
FontFamily="{StaticResource FontAwesome}"
|
FontSize="12"
|
||||||
Text="{Binding SuggestedAction, Converter={StaticResource ActionToIconConverter}}"
|
HorizontalAlignment="Right"
|
||||||
FontSize="12"
|
Foreground="LimeGreen"/>
|
||||||
HorizontalAlignment="Right"
|
|
||||||
Foreground="LimeGreen"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
@ -64,20 +79,16 @@
|
|||||||
Margin="0,6,0,0"
|
Margin="0,6,0,0"
|
||||||
FontSize="10"/>
|
FontSize="10"/>
|
||||||
|
|
||||||
|
<ProgressBar MinWidth="160"
|
||||||
<ProgressBar
|
MaxWidth="160"
|
||||||
MinWidth="160"
|
Height="10"
|
||||||
MaxWidth="160"
|
Margin="0,4,0,0"
|
||||||
Height="10"
|
Value="{Binding Progress.Percent}" />
|
||||||
Margin="0,4,0,0"
|
|
||||||
Value="{Binding Progress.Percent}" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ListBox>
|
||||||
|
|
||||||
</ItemsControl>
|
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Border>
|
</Border>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user