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 757113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:19:28+00:00 2026-05-14T15:19:28+00:00

Here is peace of the XAML code from my page: <ComboBox Grid.Row=2 Grid.Column=1 Name=Player2

  • 0

Here is peace of the XAML code from my page:

            <ComboBox Grid.Row="2" Grid.Column="1" Name="Player2" MinWidth="50"
                ItemsSource="{Binding PlayersTest}" DisplayMemberPath="ShortName">

custom object is binded to the page data context:

        page.DataContext = new SquadViewModel();

Here is part the source code of ‘SquadViewModel’ class:

public class SquadViewModel
{
    public SquadViewModel()
    {
        PlayersTest = new ObservableCollection<SostavPlayerData>();
        PlayersTest.Add(new SostavPlayerData { ShortName = "A. Sereda", });
        PlayersTest.Add(new SostavPlayerData { ShortName = "D. Sereda", });
    }

    public readonly ObservableCollection<SostavPlayerData> PlayersTest;

    public string TestText { get { return "Binding works perfectly!"; } }
}

As a result ComboBox should display a list of objects, but it is empty.

Do you know why and how to get this list?

Thank you.

P.S. I’ve tried another XAML markup

            <ComboBox Grid.Row="1" Grid.Column="1" Name="Player1" MinWidth="50"
                ItemsSource="{Binding PlayersTest}">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding ShortName}"/>
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>

It doesn’t work also, but binding to simple text block:

        <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding TestText}"/>

Works perfectly.

  • 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-14T15:19:29+00:00Added an answer on May 14, 2026 at 3:19 pm

    The problem is that PlayersTest is a field, not a property. Binding only works with properties. You can declare it using the auto property syntax to keep the code in your view model similar:

    public ObservableCollection<SostavPlayerData> PlayersTest { get; private set; }
    

    Then you just need to set it to a new instance of ObservableCollection<SostavPlayerData>, and you’ll be all set.

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

Sidebar

Related Questions

I have some troubles with saving a image from memorystream. Here is my code:
This is a XAML code sample taken from the MSDN library article for the
first post here, I come in peace :) I've searched but can't quite find
I happen to come across a Java code at my work place. Here's the
Here is a complete example. I want to forbid using A::set from objects casted
I'm attempting to convert the displayed value of a combobox by using its binding
I have xml document (you may look it up here ) from web request.
Here's my URL: https://maps.googleapis.com/maps/api/place/search/xml?location;=41.983333,-87.766666&radius;=5000&sensor;=false&type;=doctor&name;=DPM&key;= mykey I get a request denied response. I have activated
here is the working fiddle: http://jsfiddle.net/2bNsC/67/ I need to place the 3 items (text
MSSQL 2008 Maybe i'm just looking in the wrong place. Here's the scenario: We

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.