Listpicker Multiple selection and DisplayMemberPath

会有一股神秘感。 提交于 2019-12-22 18:42:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!