Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6631161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:30:27+00:00 2026-05-25T22:30:27+00:00

I am building a simple windown phone 7 Page. I’m doing MVVM (using MVVM

  • 0

I am building a simple windown phone 7 Page. I’m doing MVVM (using MVVM light) and binding a List<Category> type property to ListPicker. This property is defined in a view model named AddExpenseViewModel like below

public class AddExpenseViewModel:ViewModelBase 
{
    public List<Category> Categories
    {
        get { return categories; }
        set
        {
            categories = value;
            RaisePropertyChanged("Categories");
        }
    }
}

Category class is defined as

public class Category
{
    public string Name { get; set; }
}

In my XAML I first define a resource as

<UserControl.Resources>
<bs:ViewModelLocator x:Key="ViewModelLocator" />
</UserControl.Resources>

Then set the DataContext of the grid that contains the ListPicker as

<Grid x:Name="ContentPanel" 
              Grid.Row="1" 
              Margin="13,1,11,-1" 
              DataContext="{Binding Path=AddExpenseViewModel, 
                                    Source={StaticResource ViewModelLocator}}">

And here is my XAML for ListPicker

<toolkit:ListPicker 
            HorizontalAlignment="Left" 
            Height="50" 
            Width="200" 
            Grid.Row="2" 
            Grid.Column="1" 
            DataContext="{Binding AddExpenseViewModel}"
            ItemsSource="{Binding Path=Categories, Mode=OneWay}" >
            <toolkit:ListPicker.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Border Background="LightGreen" Width="*" Height="*">
                            <TextBlock Text="{Binding Name}"></TextBlock>
                        </Border>
                    </StackPanel>
                </DataTemplate>
            </toolkit:ListPicker.ItemTemplate>
</toolkit:ListPicker>`

This does not work. The ListPicker is always empty. Am I doing anything wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:30:28+00:00Added an answer on May 25, 2026 at 10:30 pm

    After lot of fire-fighting I got this to work myself. Here is what I changed to get this to work

    I introduced a new class as below

    public class Categories : ObservableCollection<Category>
    {
    }
    

    Then I changed the property Categories on my AddExpenseViewModel as below

    public Categories Categories
    {
        get { return categories; }
        set
        {
            categories = value;
            RaisePropertyChanged("Categories");
       }
    }
    private Categories categories;
    

    Then I changed the ItemsSource on listpicker as

    ItemsSource="{Binding Path=Categories}"
    

    This has got it working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a simple data entry app in WPF form using the MVVM pattern.
I'm building a simple Todo List application where I want to be able to
I'm building a simple java Servlet which passes categories using a URL variable into
I'm building my first simple Windows Phone app. I'm having some trouble though. I'm
I'm building a simple real time chat using Juggernaut, Redis, SQLite and Rails 3.1
Simple question: see title. I'm using .NET 3.5. Elaboration: I'm building a plugin that
I'm trying to test a mobile website I'm building using Windows Phone 7, but
I am building a simple Django app that will use scribd to display documents.
I'm building a simple ASP.NET web application in VS 2008 with a SQL 2005
I'm building a simple ice sliding puzzle to test uses of allegro. So far

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.