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

  • Home
  • SEARCH
  • 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 349673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:28:49+00:00 2026-05-12T11:28:49+00:00

How do I bind a view model property to the ListBox.SelectedItem property? I have

  • 0

How do I bind a view model property to the ListBox.SelectedItem property?

I have created a simple MVVM demo to try to figure this one out. My view model has these properties:

private ObservableCollection<DisneyCharacter> p_DisneyCharacters;
public ObservableCollection<DisneyCharacter> DisneyCharacters
{
    get { return p_DisneyCharacters; }

    set
    {
        p_DisneyCharacters = value;
        base.FirePropertyChangedEvent("DisneyCharacters");
    }
}

private DisneyCharacter p_SelectedItem;
public DisneyCharacter SelectedItem
{
    get { return p_SelectedItem; }

    set
    {
        p_SelectedItem = value;
        base.FirePropertyChangedEvent("SelectedItem");
    }
}

I want to bind the SelectedItem property to the item selected in the list box. Here is the XAML for the list box:

<ListBox ItemTemplate="{StaticResource MasterTemplate}"
         ItemsSource="{Binding Path=DisneyCharacters}" 
         SelectedItem="{Binding Path=Selectedtem, Mode=TwoWay}" 
         HorizontalAlignment="Stretch" />

Here is my problem: The view model SelectedItem property isn’t being updated when I change the selection in the list box.

I did a test where I temporarily replaced the view model SelectedItem property with a SelectedIndex property, and I bound that to the ListBox.SelectedIndex property. That property updated fine–it’s just the SelectedItem property that I can’t get to work.

So, how do I fix the SelectedItem binding? Thanks for your help.

  • 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-12T11:28:49+00:00Added an answer on May 12, 2026 at 11:28 am

    Well, there it is, big as life. In the XAML I was binding to a view model property called:

    Selectedtem
           ^^
    

    Unfortunately, the actual name is SelectedItem. So this code actually works–I solved the problem early this afternoon and then spent the rest of the afternoon and all evening scouring the web, before I noticed the spelling error.

    My wife told me at 3:00 this afternoon, "You know, it’s going to turn out to be something small." And so it did–a missing letter I. Well, at least I can go to bed now.

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

Sidebar

Related Questions

I am trying to bind my view model to the Html.Grid. I have set
I'm trying to bind my view to my view model without DataObjectProvider. The following
I am wiring up a WPF calendar to an MVVM view model. I'm not
I have an application I am creating in WPF, using MVVM pattern. In this
In my program I have a set of view-model objects to represent items in
I have a MVVM desktop application. In my View, I have a TabControl .
When I try to bind port 80 to a socket in c, i always
$(#dvMyDIV).bind(resize, function(){ alert(Resized); }); or $(#dvMyDIV).resize(function(){ alert(Resized); }); The questions Why is this not
I have a WPF ListBox that I would like to Enable multiple selection in
Assuming the following view model definition: public class MyObject { public string Name {

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.