How to: Create a Simple Binding, reviewing the article on MSDN

Translate This Page

How to: Create a Simple Binding, reviewing the article on MSDN

  • Comments 3

An example article, if you read the article for Framework 4.0, would be: How to: Create a Simple Binding, first of all tere is a mention of a SDKSample.  But there is no sample on the page.  That is because the sample is included on the article for Framework 3.0 and Framework 3.5, which you have to use the drop down next to Framework 4.0 to find.  Then it is in the middle of that page. 

It’s a typo, but can waste your time if you try to work with the article as written. 

Then when you get the sample running, if you aren’t careful the sample will need to be unblocked because it is downloaded from the internet, and the files are unsigned.

Ok, the “How To: Create a Simple Binding” shows the necessary XAML, but neglects to show the class.  How does the class work with the XAML?

First of all the class isn’t a code behind module that you might have used in earlier study or exploration, it is simply a class.  In the example


is one of the lines of XAML, and can misbehave.  First of all the letters src, as I have mentioned in another blog, could be replaced with any word, even pineapple.

When you use the form: image, if all goes well you will see the objects in the related class file in a little intellisense file, like what is in the image.

The sample code does not come with a SLN file that will automatically load the files, it only comes with a CSPROJ. In this case, make sure to unblock the files, and load the project into your Visual Studio environment, make sure to load the csproj, once it loads in, all the other files load in as well and your references are set-up nicely.  If I recall correctly, the upgrade wizard runs as well since the version for the files are Framework 3.0.

The class implements the following class and interface.  The event INotifyPropertyChanged, which has a single event: PropertyChanged.


In the PersonName property, I changed the Set to show the length of the string:

public string PersonName
          get { return name ; }
              name = "Length " + value.Length;
              // Call OnPropertyChanged whenever the property is updated

Hope this helps. Smile

Leave a Comment
  • Please add 8 and 5 and type the answer here:
  • Post
  • So did you forget to discuss OnPropertyChanged?  That seems important.  Nice that you found the sample missing, but couldn't you talk about the important point: OnPropertyChanged.  How do you use it?  

  • Thans for the samle finding.  I couldn't get examle woring and now i cna.  cna't figure out the OnPropertyChanged event to wor.

  • Good comments, kind of quick though, how did "It didn't help" and "SnappyHeadedSnake" read this blog so fast?

    First of all "It didn't help" I am working on blog for OnPropertyChanged.

    SnappyHeadedSnake, it appears that your keyboard may need to have the p and k keys cleaned, but you are definitely welcome and glad I could help out.

    Actually is this some of my students at CSUDH goofing around?  Well if it is, keep up the good work, but use your real names for reasons we discussed in class.

Page 1 of 1 (3 items)
Generic Content

Legal Note:

  1. The author, Sam Stokes, is an employee of Microsoft
  2. There is no guarantee that anything I write is correct, I do try to make sure that what I write is correct.
  3. Use anything written in this blog at your own risk
  4. Test what I write about before using the information
  • Sometimes posts will disappear because I realized that they really don't fit with the total chaos of what I write about
  • Links are tested and available on date of publication, what others do with their links are out of my control


  • Whatever I write on this blog is unedited by management or anyone, which should be obvious from the randomness of the blog.  I simply write about things I like.
  • Microsoft does not restrict me in anyway, so I generallyblather about whatever I want to.
  • For personal reasons I will not write about:
    • Company confidential stuff, mainly because Microsoft is more transparent than any company I have ever worked for.
    • Other people unless they give me permission to write about them