Skip to content

Commit

Permalink
Update virtualizingWrapanel, fixes #62
Browse files Browse the repository at this point in the history
  • Loading branch information
DSPaul committed Jan 23, 2024
1 parent f550509 commit 283e57c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 30 deletions.
12 changes: 6 additions & 6 deletions src/COMPASS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,29 @@
<PackageReference Include="FuzzySharp" Version="2.0.2" />
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
<PackageReference Include="HtmlAgilityPack">
<Version>1.11.54</Version>
<Version>1.11.57</Version>
</PackageReference>
<PackageReference Include="itext7">
<Version>8.0.2</Version>
</PackageReference>
<PackageReference Include="itext7.bouncy-castle-adapter" Version="8.0.2" />
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.4.0" />
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.5.0" />
<PackageReference Include="Magick.NET.SystemDrawing" Version="7.2.0" />
<PackageReference Include="MaterialDesignThemes">
<Version>4.9.0</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.8.0.20230708" />
<PackageReference Include="OpenCvSharp4.Windows" Version="4.8.0.20230708" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.9.0.20240103" />
<PackageReference Include="OpenCvSharp4.Windows" Version="4.9.0.20240103" />
<PackageReference Include="ScrapySharp">
<Version>3.0.0</Version>
</PackageReference>
<PackageReference Include="Selenium.WebDriver">
<Version>4.15.0</Version>
<Version>4.17.0</Version>
</PackageReference>
<PackageReference Include="VirtualizingWrapPanel" Version="1.5.8" />
<PackageReference Include="VirtualizingWrapPanel" Version="2.0.3" />
<PackageReference Include="WpfAnimatedGif" Version="2.0.2" />
<PackageReference Include="ZXing.Net" Version="0.16.9" />
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
Expand Down
38 changes: 21 additions & 17 deletions src/Views/CardLayout.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:dd="urn:gong-wpf-dragdrop"
xmlns:tools ="clr-namespace:COMPASS.Tools"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:wpftk="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
xmlns:vwp="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
xmlns:converters="clr-namespace:COMPASS.Converters"
xmlns:layouts="clr-namespace:COMPASS.ViewModels.Layouts"
d:DataContext="{d:DesignInstance Type=layouts:CardLayoutViewModel}"
Expand All @@ -17,17 +17,17 @@
<tools:BindingProxy x:Key="CodexProxy" Data="{Binding CodexVM}"/>
</UserControl.Resources>
<!--#region CardView-->
<wpftk:GridView x:Name="CardLayoutListBox" ItemsSource="{Binding MVM.CollectionVM.FilterVM.FilteredCodices, Mode=OneWay}"
BorderBrush="{x:Null}" SelectedItem="{Binding SelectedCodex, Mode=TwoWay}" SelectionMode="Extended"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" Margin="10,0" Background="{x:Null}"
PreviewKeyDown="CardLayoutListBox_PreviewKeyDown"
dd:DragDrop.IsDropTarget="True" dd:DragDrop.DropHandler="{Binding CodexVM}"
VirtualizingPanel.IsVirtualizing="{Binding DoVirtualization}"
VirtualizingPanel.IsVirtualizingWhenGrouping="{Binding DoVirtualization}"
VirtualizingPanel.CacheLengthUnit="Item" VirtualizingPanel.CacheLength="10"
VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.ScrollUnit="Pixel">
<wpftk:GridView.ItemContainerStyle>
<ListView x:Name="CardLayoutListBox" ItemsSource="{Binding MVM.CollectionVM.FilterVM.FilteredCodices, Mode=OneWay}"
BorderBrush="{x:Null}" SelectedItem="{Binding SelectedCodex, Mode=TwoWay}" SelectionMode="Extended"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" Margin="10,0" Background="{x:Null}"
PreviewKeyDown="CardLayoutListBox_PreviewKeyDown"
dd:DragDrop.IsDropTarget="True" dd:DragDrop.DropHandler="{Binding CodexVM}"
VirtualizingPanel.IsVirtualizing="{Binding DoVirtualization}"
VirtualizingPanel.IsVirtualizingWhenGrouping="{Binding DoVirtualization}"
VirtualizingPanel.CacheLengthUnit="Item" VirtualizingPanel.CacheLength="100"
VirtualizingPanel.VirtualizationMode="Recycling"
VirtualizingPanel.ScrollUnit="Pixel">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<EventSetter Event="MouseDoubleClick" Handler="HandleDoubleClick" />
<Setter Property="Background" Value="Transparent"/>
Expand All @@ -53,9 +53,13 @@
</DataTrigger>
</Style.Triggers>
</Style>
</wpftk:GridView.ItemContainerStyle>

<wpftk:GridView.ItemTemplate>
</ListView.ItemContainerStyle>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<vwp:VirtualizingWrapPanel AllowDifferentSizedItems="True" Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Border CornerRadius="5" Margin="5" Width="400" Background="{StaticResource CardBackground}" SnapsToDevicePixels="True"
BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" BorderThickness="3"
Expand Down Expand Up @@ -187,7 +191,7 @@
</StackPanel>
</Border>
</DataTemplate>
</wpftk:GridView.ItemTemplate>
</wpftk:GridView>
</ListView.ItemTemplate>
</ListView>
<!--#endregion-->
</UserControl>
19 changes: 12 additions & 7 deletions src/Views/TileLayout.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:dd="urn:gong-wpf-dragdrop"
xmlns:converters="clr-namespace:COMPASS.Converters"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:wpftk="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
xmlns:vwp="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
xmlns:layouts="clr-namespace:COMPASS.ViewModels.Layouts"
d:DataContext="{d:DesignInstance Type=layouts:TileLayoutViewModel}"
mc:Ignorable="d"
Expand All @@ -15,7 +15,7 @@
<converters:UriToBitmapConverter x:Key="UriToBitmapConverter" />
</UserControl.Resources>

<wpftk:GridView x:Name="TileLayoutListBox" FocusVisualStyle="{x:Null}"
<ListView x:Name="TileLayoutListBox" FocusVisualStyle="{x:Null}"
ItemsSource="{Binding MVM.CollectionVM.FilterVM.FilteredCodices}"
Background="{x:Null}" BorderBrush="{x:Null}" VerticalContentAlignment="Top"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" Margin="10,0" SelectionMode="Extended"
Expand All @@ -26,7 +26,7 @@
VirtualizingPanel.IsVirtualizingWhenGrouping="{Binding DoVirtualization}"
VirtualizingPanel.CacheLengthUnit="Item" VirtualizingPanel.CacheLength="20"
VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.ScrollUnit="Pixel">
<wpftk:GridView.ItemContainerStyle>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<EventSetter Event="MouseDoubleClick" Handler="HandleDoubleClick" />
<Setter Property="Background" Value="Transparent"/>
Expand All @@ -52,8 +52,13 @@
</DataTrigger>
</Style.Triggers>
</Style>
</wpftk:GridView.ItemContainerStyle>
<wpftk:GridView.ItemTemplate>
</ListView.ItemContainerStyle>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<vwp:VirtualizingWrapPanel AllowDifferentSizedItems="True" Orientation="Horizontal" SpacingMode="Uniform"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Grid VerticalAlignment="Top" Margin="0,10" RenderTransformOrigin="0.5,0.5"
Background="Transparent">
Expand Down Expand Up @@ -153,6 +158,6 @@
</Grid>
</Grid>
</DataTemplate>
</wpftk:GridView.ItemTemplate>
</wpftk:GridView>
</ListView.ItemTemplate>
</ListView>
</UserControl>

0 comments on commit 283e57c

Please sign in to comment.