问题
I have a collection of my custom entity that is bound to the listpicker using the ItemsSource
property. I also have selection mode set to Multiple
so I have a checkbox with each item in the FullMode picker. This picking works, fine, and I can easily access all objects that were picked thru code. What I'm having troubles with is the DisplayMemberPath
. I want to display something more friendly than the namespace of the object that is selected. Perhaps a count of selected items, or a comma separated list of the values selected.
Unfortunately, 'AccountId' doesn't work when I set the SelectionMode="Multiple". Single mode is fine. Any ideas?
<toolkit:ListPicker
x:Name="accountlistpicker"
Grid.Row="0" Header="accounts"
SelectionMode="Multiple"
DisplayMemberPath="AccountId"
ItemsSource="{Binding AllAccounts}"
FullModeItemTemplate="{StaticResource AccountsListPickerFullItemTemplate}" />
回答1:
You need to assign function to SummaryForSelectedItemsDelegate
that will process how summary string will looks like.
Check this for learn more
来源:https://stackoverflow.com/questions/8670898/listpicker-multiple-selection-and-displaymemberpath