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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:37:33+00:00 2026-06-06T16:37:33+00:00

I am working on a Silverlight application, and I want to bind the simple

  • 0

I am working on a Silverlight application, and I want to bind the simple text property of textblock through a property of string type.

What I did was:

<TextBlock Text="{Binding Name}"/>

Code behind:

public string Name{get;set;}

Name = "Testing..!";

but it will not work.

  • 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-06-06T16:37:34+00:00Added an answer on June 6, 2026 at 4:37 pm

    To expand on anatoliiG’s answer (which will work): Data binding refers to properties on the DataContext property of the current element by default. This means that your

    <TextBlock Text="{Binding Name}" />
    

    is actually translated to

    Set the value of the Text property to this.DataContext.Name

    (DataContext is inherited, so if it is not explicitly set on the TextBlock it will check the parent, then the parent of the parent etc etc)

    You can resolve your problem in one of two ways:

    1. You can set the value of this.DataContext on the parent to the parent itself (as anatoliiG suggests). This means that when it looks up this.DataContext.Name it will be checking the Page itself, which is where your Name property is found.

    2. You can change your Binding so it looks at the Page instead of Page.DataContext when it is looking up bindings. You can achieve this using the RelativeSource markup extension:

    This translates to:

    Find the first ancestor of the TextBlock that is of type Page, and bind to the Name property on that object

    As a final note, you will also need to implement INotifyPropertyChanged on your DataContext object if you are going to ever change the value of Name.

    Oh, and you should be using view models as the DataContext instead of the Page itself!

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

Sidebar

Related Questions

I am working on a C# Silverlight application that needs some text rotated 90
I am working on a Silverlight web application that creates PDF documents. We want
I am working on Silverlight application and I want to make Image mousedouble click
I'm working on building a Silverlight application whereas we want to be able to
I'm working on a silverlight application where I'm checking the url to see if
I'm working on a Silverlight application that works with WCF services. While loading the
I'm currently working on a Silverlight application connected to a SQL Server 2008 Express
I am trying to get out of browser support working for my Silverlight application
I am currently working on a silverlight business application, so I have come across
I am currently working on an application that allows reverse geocoding using silverlight +

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.