0

在这种情况下,我不应该在 ListPicker 中看到列表中的值吗?

xml

<toolkit:ListPicker
                x:Name="lpkBoards"
                ItemsSource="{Binding AllBoards}"
                DisplayMemberPath="Name" >
                </toolkit:ListPicker>

xml.cs

public SettingsPage()
        {
            InitializeComponent();

            // Set the page DataContext property to the ViewModel.
            this.DataContext = App.ViewModel;

         ...

            boardsTask.ContinueWith(
                (call) =>
                {
                    App.ViewModel.AllBoards = call.Result.ToList();

                }
                );

视图模型

// All to-do items.
private List<Board> _allBoards;
public List<Board> AllBoards
{
    get { return _allBoards; }
    set
    {
        _allBoards = value;
        NotifyPropertyChanged("AllBoards");
    }
}
4

1 回答 1

1

如果您尝试将其绑定到 UI 元素并希望它工作,则需要将其更改List<Board>为。ObservalbeCollection<Board>

于 2013-02-22T02:41:57.080 回答