ThumbnailsControl.xaml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <UserControl x:Class="ComPDFKitDemo.BOTA.ThumbnailsControl"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="using:PDFViewWPFTestCS"
  7. xmlns:wpftk="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
  8. mc:Ignorable="d"
  9. d:DesignHeight="138" d:DesignWidth="223"
  10. Loaded="UserControl_Loaded"
  11. Unloaded="UserControl_Unloaded"
  12. PreviewMouseWheel ="UserControl_PreviewMouseWheel">
  13. <UserControl.Resources>
  14. <ResourceDictionary>
  15. <ResourceDictionary.MergedDictionaries>
  16. <ResourceDictionary Source="../Resources/StyleResource.xaml"/>
  17. </ResourceDictionary.MergedDictionaries>
  18. </ResourceDictionary>
  19. </UserControl.Resources>
  20. <Grid>
  21. <ListBox Name="ThumbnailListBox" SelectionChanged="ThumbnailListBox_SelectionChanged"
  22. SelectionMode="Extended" ScrollViewer.CanContentScroll="True"
  23. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  24. ScrollViewer.ScrollChanged="thumbnailScrollViewer_ScrollChanged"
  25. ScrollBar.Scroll="ThumbnailListBox_Scroll"
  26. Background="White" VirtualizingPanel.IsVirtualizing="True"
  27. VirtualizingPanel.VirtualizationMode="Recycling">
  28. <ListBox.Resources>
  29. <Style TargetType="ListBoxItem">
  30. <Setter Property="HorizontalContentAlignment" Value="Left" />
  31. <Setter Property="VerticalContentAlignment" Value="Center" />
  32. </Style>
  33. </ListBox.Resources>
  34. <ListBox.ItemContainerStyle>
  35. <Style TargetType="ListBoxItem">
  36. <Setter Property="HorizontalContentAlignment" Value="Left" />
  37. <Setter Property="VerticalContentAlignment" Value="Center" />
  38. </Style>
  39. </ListBox.ItemContainerStyle>
  40. <ListBox.ItemsPanel>
  41. <ItemsPanelTemplate>
  42. <wpftk:VirtualizingWrapPanel></wpftk:VirtualizingWrapPanel>
  43. </ItemsPanelTemplate>
  44. </ListBox.ItemsPanel>
  45. <ListBox.ItemTemplate>
  46. <DataTemplate>
  47. <StackPanel>
  48. <Viewbox Margin="0,5,0,0" Stretch="Uniform" Width="{Binding ThumbnailWidth}" Height="{Binding ThumbnailHeight}">
  49. <Border BorderThickness="2" BorderBrush="Black">
  50. <Image Source="{Binding Path=ImageData.Source}" Margin="0,0,5,0" Width="{Binding ImageWidth}" Height="{Binding ImageHeight}"></Image>
  51. </Border>
  52. </Viewbox>
  53. <TextBlock Text="{Binding ShowPageText}" HorizontalAlignment="Center"></TextBlock>
  54. </StackPanel>
  55. </DataTemplate>
  56. </ListBox.ItemTemplate>
  57. </ListBox>
  58. </Grid>
  59. </UserControl>