Implementing a list of items with multiple choices

In my WP8 application, I would like to implement functionality very similar to what is present in a standard mail application - the ability for the user to select several items from a list. I have provided some screenshots to illustrate this behavior:

Normal condition:
Normal state

The user taps an item in the left corner and turns blue: User taps item's left corner and it becomes blue

Item selected
Item is selected

My question is, is this multi-select option a standard option for any container control, or if I have to execute some user programs to achieve this? In the latter case, what is the best approach you take to implement it, share your thoughts.

+4
source share
2 answers

For WP8 Multi-Selection, you will need the Windows Phone Toolkit LongListMultiSelector.

You can find code examples on how to use LongListMultiSelector here (and here for the code). Here are the relevant snippets of XAML code:

<phone:PivotItem x:Name="BuddiesPivotItem" Header="Std longlistmultiselector"> <toolkit:LongListMultiSelector x:Name="buddies" Background="Transparent" Margin="0,-8,0,0" ItemsSource="{StaticResource buddies}" LayoutMode="List" IsGroupingEnabled="True" HideEmptyGroups="True" JumpListStyle="{StaticResource BuddiesJumpListStyle}" GroupHeaderTemplate="{StaticResource BuddiesGroupHeaderTemplate}" ItemTemplate="{StaticResource BuddiesItemTemplate}" /> </phone:PivotItem> <phone:PivotItem x:Name="GridModeItem" Header="Grid mode"> <toolkit:LongListMultiSelector x:Name="GridSelector" ItemsSource="{StaticResource PicturesAlbum}" IsGroupingEnabled="False" GridCellSize="210,180" LayoutMode="Grid" HideEmptyGroups="True" ItemTemplate="{StaticResource PictureItemTemplate}" IsSelectionEnabledChanged="OnGridSelectorIsSelectionEnabledChanged" SelectionChanged="OnGridSelectorSelectionChanged" /> </phone:PivotItem> 

When you run this piece of code, you can see the following:

LongListMutliSelector print screen

Read more about the Windows Phone 8 Toolkit utility here .

+11
source

My toolkit is missing LonglistmultiSelector.

if I run the following code:

 <toolkit:LongListMultiSelector x:Name="EmailList" Margin="0,14,-12,0" ItemsSource="{StaticResource EmailCollection}" LayoutMode="List" SelectionChanged="OnEmailListSelectionChanged" IsSelectionEnabledChanged="OnEmailListIsSelectionEnabledChanged" ItemTemplate="{StaticResource EmailItemTemplate}" ItemInfoTemplate="{StaticResource EmailItemInfoTemplate}" /> 

if you get an error: Error 1 The name "LongListMultiSelector" does not exist in the namespace "clr namespace: Microsoft.Phone.Controls; assembly = Microsoft.Phone.Controls.Toolkit".

+2
source

All Articles