Skip to content

Instantly share code, notes, and snippets.

@julesx
Created November 6, 2021 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julesx/4794b289cb9726d759d1406a941832fd to your computer and use it in GitHub Desktop.
Save julesx/4794b289cb9726d759d1406a941832fd to your computer and use it in GitHub Desktop.
<ListBox x:Class="PG.UserControls.ListBoxPgItems"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:classes="clr-namespace:WPF.Core.Classes;assembly=WPF.Core"
mc:Ignorable="d"
SelectionMode="Extended"
Style="{StaticResource MaterialDesignListBox}"
xmlns:controls="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:behaviors="clr-namespace:WPF.Core.Behaviors;assembly=WPF.Core"
d:DesignHeight="450" d:DesignWidth="800">
<i:Interaction.Behaviors>
<behaviors:MultiSelectionBehavior SelectedItems="{Binding SelectedPgItems}" />
</i:Interaction.Behaviors>
<ListBox.Resources>
<ResourceDictionary>
<Style x:Key="ListBoxPgItemStyle" BasedOn="{StaticResource MaterialDesignCardsListBoxItem}" TargetType="ListBoxItem">
<Setter Property="Height" Value="{Binding DataContext.ListBoxItemHeight, Source={classes:RootObject}}" />
<Setter Property="Width" Value="{Binding DataContext.ListBoxItemWidth, Source={classes:RootObject}}" />
<EventSetter Event="PreviewMouseDoubleClick" Handler="ListBoxItem_PreviewMouseDoubleClick" />
</Style>
</ResourceDictionary>
</ListBox.Resources>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<controls:VirtualizingWrapPanel SpacingMode="StartAndEndOnly" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment