|
4 | 4 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
5 | 5 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
6 | 6 | xmlns:local="clr-namespace:Zhai.PictureView" |
| 7 | + xmlns:wpftk="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel" |
7 | 8 | xmlns:Controls="clr-namespace:Zhai.PictureView.Controls" |
8 | 9 | xmlns:XamlServices="clr-namespace:Zhai.PictureView.XamlServices" |
9 | 10 | Title="{Binding CurrentPicture, Converter={StaticResource PictureViewTitleConverter}}" |
|
357 | 358 | </DockPanel> |
358 | 359 | </Border> |
359 | 360 | </Grid> |
360 | | - <Grid Grid.ColumnSpan="3" Grid.Row="2"> |
| 361 | + <Grid Grid.ColumnSpan="3" Grid.Row="2" x:Name="PictureController"> |
361 | 362 | <StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Orientation="Horizontal" Margin="8"> |
362 | 363 | <StackPanel Orientation="Horizontal" IsEnabled="{Binding CurrentPicture, Converter={StaticResource NullableToBoolConverter}}"> |
363 | 364 | <Button x:Name="PictureListViewToggleButton" Click="PictureListViewToggleButton_Click"> |
|
425 | 426 | <Path Data="{StaticResource Icon.RotateRight}"/> |
426 | 427 | </Button> |
427 | 428 | <Button x:Name="AutoPlayButton" Click="AutoPlayButton_Click" ToolTip="自动播放" |
428 | | - Visibility="{Binding IsShowPictureListView, Converter={StaticResource BoolToVisibilityConverter}}"> |
| 429 | + Visibility="{Binding CanPictureCarouselPlay, Converter={StaticResource BoolToVisibilityConverter}}"> |
429 | 430 | <Button.Style> |
430 | 431 | <Style TargetType="{x:Type Button}" BasedOn="{StaticResource PictureView.IconButton}"> |
431 | 432 | <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/> |
|
480 | 481 | </StackPanel> |
481 | 482 | </StackPanel> |
482 | 483 | </Grid> |
| 484 | + <Grid Grid.ColumnSpan="3" Grid.RowSpan="3" x:Name="GalleryView" |
| 485 | + Background="{StaticResource PictureWindowPaperColorBrush}" |
| 486 | + Visibility="{Binding IsShowGallery, Converter={StaticResource BoolToVisibilityConverter}}"> |
| 487 | + <ListView ItemsSource="{Binding ElementName=PictureList, Path=Items}" |
| 488 | + SelectedItem="{Binding CurrentPicture}" |
| 489 | + Margin="3 36 3 8" Background="Transparent" BorderThickness="0" |
| 490 | + VirtualizingPanel.CacheLengthUnit="Item" |
| 491 | + VirtualizingPanel.ScrollUnit="Pixel" |
| 492 | + VirtualizingPanel.VirtualizationMode="Standard"> |
| 493 | + <ListBox.ItemContainerStyle> |
| 494 | + <Style TargetType="{x:Type ListBoxItem}"> |
| 495 | + <Setter Property="Margin" Value="0"/> |
| 496 | + <Setter Property="Padding" Value="0"/> |
| 497 | + <Setter Property="BorderThickness" Value="2"/> |
| 498 | + <Setter Property="BorderBrush" Value="Transparent"/> |
| 499 | + <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/> |
| 500 | + <Setter Property="RenderTransform"> |
| 501 | + <Setter.Value> |
| 502 | + <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="0.95" ScaleY="0.95" /> |
| 503 | + </Setter.Value> |
| 504 | + </Setter> |
| 505 | + <Setter Property="Template"> |
| 506 | + <Setter.Value> |
| 507 | + <ControlTemplate TargetType="{x:Type ListBoxItem}"> |
| 508 | + <Border BorderBrush="{TemplateBinding BorderBrush}" HorizontalAlignment="Center" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true"> |
| 509 | + <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> |
| 510 | + </Border> |
| 511 | + <ControlTemplate.Triggers> |
| 512 | + <Trigger Property="IsMouseOver" Value="True"> |
| 513 | + <Setter Property="RenderTransform"> |
| 514 | + <Setter.Value> |
| 515 | + <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1" ScaleY="1" /> |
| 516 | + </Setter.Value> |
| 517 | + </Setter> |
| 518 | + </Trigger> |
| 519 | + <Trigger Property="IsSelected" Value="True"> |
| 520 | + <Setter Property="BorderBrush" Value="DeepSkyBlue"/> |
| 521 | + </Trigger> |
| 522 | + </ControlTemplate.Triggers> |
| 523 | + </ControlTemplate> |
| 524 | + </Setter.Value> |
| 525 | + </Setter> |
| 526 | + </Style> |
| 527 | + </ListBox.ItemContainerStyle> |
| 528 | + <ListView.ItemsPanel> |
| 529 | + <ItemsPanelTemplate> |
| 530 | + <wpftk:VirtualizingWrapPanel Orientation="Vertical" SpacingMode="StartAndEndOnly" StretchItems="True"/> |
| 531 | + </ItemsPanelTemplate> |
| 532 | + </ListView.ItemsPanel> |
| 533 | + <ListView.ItemTemplate> |
| 534 | + <DataTemplate> |
| 535 | + <Border Width="120" Height="120"> |
| 536 | + <Image Stretch="Uniform" Source="{Binding ThumbSource}" ToolTip="{Binding Name}" |
| 537 | + XamlServices:PictureService.Picture="{Binding}"/> |
| 538 | + </Border> |
| 539 | + </DataTemplate> |
| 540 | + </ListView.ItemTemplate> |
| 541 | + </ListView> |
| 542 | + <Grid.Style> |
| 543 | + <Style TargetType="{x:Type Grid}"> |
| 544 | + <Style.Triggers> |
| 545 | + <Trigger Property="Visibility" Value="Visible"> |
| 546 | + <Trigger.EnterActions> |
| 547 | + <BeginStoryboard> |
| 548 | + <Storyboard> |
| 549 | + <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.3"/> |
| 550 | + </Storyboard> |
| 551 | + </BeginStoryboard> |
| 552 | + </Trigger.EnterActions> |
| 553 | + </Trigger> |
| 554 | + </Style.Triggers> |
| 555 | + </Style> |
| 556 | + </Grid.Style> |
| 557 | + </Grid> |
483 | 558 | </Grid> |
484 | 559 | </local:PictureWindow> |
0 commit comments