Note that there are some explanatory texts on larger screens.

plurals
  1. POwpf Select Multiple ListboxItems(i.e, Images) using Keyboard[Ctrl + RightArrow/leftArrow]
    text
    copied!<p>I Have grouped the listbox items,i can able to select "Multiple" items by SelectionMode="Extended" or "Multiple". Now i have got two issues and one more thing in "Sorting"</p> <ol> <li>When </li> </ol> <blockquote> <p>[ SelectionMode="Extended"]</p> </blockquote> <p>i can select Multiple Items by pressing and selecting the items using Mouse, once i move the mouse to the others controls,i'm losing my selection.</p> <p>2.I'm unable to select Multiple items using Keyboard and unable to travel to listboxItems(i.e,) "Images" using Arrow Keys.</p> <ol> <li><p>I want to sort/Arrange the grouped Items. could anybody guide over these..thnx in advance.</p> <p></p> <pre><code> &lt;CollectionViewSource x:Key="CharacterCollectionView" Source="{Binding}" &gt; &lt;CollectionViewSource.GroupDescriptions&gt; &lt;PropertyGroupDescription PropertyName="Name" /&gt; &lt;/CollectionViewSource.GroupDescriptions&gt; &lt;!--&lt;CollectionViewSource.SortDescriptions&gt; &lt;cm:SortDescription PropertyName="First" /&gt; &lt;/CollectionViewSource.SortDescriptions&gt;--&gt; &lt;/CollectionViewSource&gt; &lt;ItemsPanelTemplate x:Key="HorizontalItemsPanel"&gt; &lt;WrapPanel Orientation="Horizontal" HorizontalAlignment="Stretch" /&gt; &lt;/ItemsPanelTemplate&gt; &lt;Style x:Key="myListboxStyle"&gt; &lt;Style.Resources&gt; &lt;!-- Background of selected item when focussed --&gt; &lt;LinearGradientBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" StartPoint="0.5,0" EndPoint="0.5,1"&gt; &lt;GradientStop Color="#66000000" Offset="0" /&gt; &lt;GradientStop Color="#33000000" Offset="1" /&gt; &lt;/LinearGradientBrush&gt; &lt;!-- Background of selected item when not focussed --&gt; &lt;LinearGradientBrush x:Key="{x:Static SystemColors.ControlBrushKey}" StartPoint="0.5,0" EndPoint="0.5,1"&gt; &lt;GradientStop Color="#66000000" Offset="0" /&gt; &lt;GradientStop Color="#33000000" Offset="1" /&gt; &lt;/LinearGradientBrush&gt; &lt;/Style.Resources&gt; &lt;/Style&gt; &lt;/Window.Resources&gt; &lt;DockPanel&gt; &lt;StackPanel Orientation="Vertical" DockPanel.Dock="Left" Background="#336699" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" &gt; &lt;ListBox Margin="20,20,20,5" DataContext="{Binding}" ItemsSource="{Binding Source={StaticResource CharacterCollectionView}}" DockPanel.Dock="Top" x:Name="MyList" MouseEnter="MyListEvent" Width="700" SelectionMode="Extended" Style="{StaticResource myListboxStyle }" Height="700" Background="LightGray" IsSynchronizedWithCurrentItem="True" ScrollViewer.CanContentScroll="True" SelectedIndex="1" ScrollViewer.VerticalScrollBarVisibility="Visible" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" PresentationTraceSources.TraceLevel="High" &gt; &lt;ListBox.ItemContainerStyle&gt; &lt;Style TargetType="{x:Type ListBoxItem}"&gt; &lt;Setter Property="HorizontalContentAlignment" Value="Stretch"/&gt; &lt;Setter Property="VerticalContentAlignment" Value="Stretch"/&gt; &lt;Setter Property="Padding" Value="0"/&gt; &lt;Setter Property="Margin" Value="1"/&gt; &lt;Setter Property="BorderBrush" Value="Green"/&gt; &lt;Setter Property="Width" Value="{Binding Path=Value, ElementName=sizeSlider, Mode=TwoWay}"/&gt; &lt;Setter Property="Height" Value="{Binding Path=Value, ElementName=sizeSlider, Mode=TwoWay}"/&gt; &lt;!--&lt;Style.Triggers&gt; &lt;Trigger Property="IsKeyboardFocusWithin" Value="True"&gt; &lt;Setter Property="IsSelected" Value="True" /&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt;--&gt; &lt;/Style&gt; &lt;/ListBox.ItemContainerStyle&gt; &lt;ListBox.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;WrapPanel Orientation="Horizontal" HorizontalAlignment="Stretch" Background="LightSteelBlue" /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ListBox.ItemsPanel&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;Viewbox Stretch="Fill" HorizontalAlignment="Stretch" &gt; &lt;Border BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" DataContext="{Binding}" BorderBrush="IndianRed" Margin="0" Height="Auto"&gt; &lt;DockPanel&gt; &lt;Image DockPanel.Dock="Top" Width="150" Margin="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" x:Name="Myimage" Source="{Binding Path=ImageFilepath[0]}"/&gt; &lt;Grid&gt; &lt;Label Content="{Binding Path=Name[0]}" HorizontalContentAlignment="Center" FontWeight="Normal" FontSize="13" /&gt; &lt;/Grid&gt; &lt;/DockPanel&gt; &lt;/Border&gt; &lt;/Viewbox&gt; &lt;/DataTemplate&gt; &lt;/ListBox.ItemTemplate&gt; &lt;ListBox.GroupStyle&gt; &lt;GroupStyle&gt; &lt;GroupStyle.HeaderTemplate&gt; &lt;DataTemplate&gt; &lt;TextBlock Text="{Binding Name}" FontSize="18" Height="Auto" Background="Transparent" FontWeight="Medium" /&gt; &lt;/DataTemplate&gt; &lt;/GroupStyle.HeaderTemplate&gt; &lt;GroupStyle.Panel&gt; &lt;ItemsPanelTemplate&gt; &lt;WrapPanel Orientation="Horizontal" HorizontalAlignment="Stretch" Background="White" /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/GroupStyle.Panel&gt; &lt;GroupStyle.ContainerStyle&gt; &lt;Style TargetType="{x:Type GroupItem}"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type GroupItem}"&gt; &lt;GroupBox Header="{Binding Name}" BorderBrush="#336699" BorderThickness="2" Margin="5"&gt; &lt;ItemsPresenter /&gt; &lt;/GroupBox&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/GroupStyle.ContainerStyle&gt; &lt;/GroupStyle&gt; &lt;/ListBox.GroupStyle&gt; &lt;/ListBox&gt; &lt;StackPanel Grid.Row="1" HorizontalAlignment="Center" Orientation="Horizontal" Margin="2,0,5,5"&gt; &lt;TextBlock Width="Auto" Text="Min" Foreground="White" FontWeight="Bold" FontSize="14" Margin="2" Padding="0" HorizontalAlignment="Right" /&gt; &lt;Slider Name="sizeSlider" Width="300" Orientation="Horizontal" Value="200" Background="PowderBlue" IsSnapToTickEnabled="True" Minimum="150" Maximum="250" TickPlacement="BottomRight" TickFrequency="50" AutoToolTipPrecision="10" AutoToolTipPlacement="TopLeft" IsDirectionReversed="False" IsMoveToPointEnabled="False" /&gt; &lt;TextBlock Width="Auto" Text="{Binding Value, ElementName=sizeSlider}" Foreground="White" FontWeight="Bold" FontSize="14" Margin="2" Padding="0" /&gt; &lt;/StackPanel&gt; </code></pre></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload