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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:13:56+00:00 2026-05-22T14:13:56+00:00

Im having some problems with setting up databinding in Silverlight. Im trying to use

  • 0

Im having some problems with setting up databinding in Silverlight.

Im trying to use the MVVM approach and found some nice examples, So Ive created my View and my ViewModel, I created some classes Im going to use to contain the data and one to populate the classes.

Firstly my ViewModel looks like:

 public class MainPageVM : INotifyPropertyChanged
    {
        ObservableCollection<Item> Items;
        public MainPageVM()
        {
            InitializeItems InitItems = new InitializeItems();
            InitItems.GenerateItemList(out Items);
            RaiseProertyChanged("Items");
        }
        public string test = "Binding Test";

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        private void RaiseProertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this,new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

And then in my View i have :

<UserControl.Resources>
    <viewmodel:MainPageVM x:Key="ViewModel" />    
</UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White" DataContext="{StaticResource ViewModel}">
    <StackPanel>
        <TextBlock Text="{Binding test}"/>
        <ListBox ItemsSource="{Binding Items}"
             Width="200"
             Height="200">
            <ListBoxItem Width="190" Height="20">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding ItemName}"/>
                    <TextBlock Text="-"/>
                    <TextBlock Text="{Binding ItemID}"/>
                </StackPanel>
            </ListBoxItem>
        </ListBox>
    </StackPanel>
</Grid>

I added breakpoints and I know my ObservableCollection that im trying to bind to is being populated but nothing binds, in the error window im just getting xxx property doesnt exist in MainPageVM.

Any advice here would be great as im a bit lost as to what could be going on, and this is my first silverlight application.

Thanks

  • 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-22T14:13:56+00:00Added an answer on May 22, 2026 at 2:13 pm

    Items needs to be a public property. Same with your test field. In Silverlight you can only bind to public properties.

    Also, typically in the Setter of those properties you raise the property changed event. This tells the Silverlight runtime to refresh the controls that are bound to that property with the new values of that property.

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

Sidebar

Related Questions

I have been having some problems trying to get my PHP running. When I
I'm having some problems with my WCF server and client connections. If I use
I'm having some beginner problems setting an FFI struct in Ruby. What I want
I am having some problems setting up Tomcat for JMX. I added the following
I am having some weird problems trying to position the h3 tag over the
I'm currently having some problems with setting up the right routes for my application.
I'm having some troubles setting up two Areas in my project, I created both
I'm having some problems trying to get a background upload system working using WebWorkers
Currently having some problems- now = datetime.datetime.now() month = now.strftime(%B) site = wikipedia.getSite('en', 'wikiquote')
Im having some problems getting the Sticky Footer to work on my site. If

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.