VirtualizingStackPanel + MVVM + multiple selection

I found another way of handling selection in the MVVM pattern, which solved my issue. Instead of maintaining the selection in the viewmodel, the selection is retrieved from the ListView/ListBox, and passed as a parameter to the Command. All done in XAML: <ListView x:Name=”_items” ItemsSource=”{Binding Items}” … /> <Button Content=”Remove Selected” Command=”{Binding RemoveSelectedItemsCommand}” CommandParameter=”{Binding ElementName=_items, … Read more

How can I get ScrollViewer to work inside a StackPanel?

This was bugging me for a while too, the trick is to put your stackpanel within a scrollviewer. Also, you need to ensure that you set the CanContentScroll property of the scroll viewer to True, here’s an example: <ScrollViewer Grid.Row=”1″ Margin=”299,12,34,54″ Name=”ScrollViewer1″ VerticalScrollBarVisibility=”Auto” HorizontalScrollBarVisibility=”Auto” Height=”195″ CanContentScroll=”True”> <StackPanel Name=”StackPanel1″ OverridesDefaultStyle=”False” Height=”193″ Width=”376″ VerticalAlignment=”Top” HorizontalAlignment=”Left”></StackPanel> </ScrollViewer>