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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:19:58+00:00 2026-06-05T11:19:58+00:00

This probably sounds really stupid, but I just can’t get a binding to an

  • 0

This probably sounds really stupid, but I just can’t get a binding to an instance variable (of type string) to work.

In my view’s xib, I create a text field as an outlet in IB, then I can bind it to my viewModel’s string property. However, it won’t let me bind my view’s string variable to the viewModel’s property in the same way.

Does anyone know if this is by design, or am I missing something? The binding code is –

this.AddBindings(
     new Dictionary<object, string>()
     {
          { TextFieldTemp, "{'Text':{'Path':'AboutText'}}" },
     });
  • 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-05T11:19:59+00:00Added an answer on June 5, 2026 at 11:19 am

    From reading your question, I think what you are saying is that the View itself has a field of type string…

    Your code:

    this.AddBindings(
         new Dictionary<object, string>()
         {
              { StringTemp, "{'Text':{'Path':'AboutText'}}" },
         });
    

    is trying to bind the property Text on the object referred to by StringTemp to whatever is in AboutText on the ViewModel.


    To set the StringTemp string itself you should be able to bind to it using something like:

     this.AddBindings(
          new Dictionary<object, string>()
          {
               { this, "{'StringTemp':{'Path':'AboutText'}}" },
          });
    

    Just to explain the parts in: { this, "{'StringTemp':{'Path':'AboutText'}}" }, these can be thought of as { TargetObject, "{'TargetPropertyName':{'Path':'SourcePropertyName'}}" } where:

    • TargetObject (this) is the object you are aiming to set property values on
    • TargetPropertyName (StringTemp) is the name property that you are aiming to set
    • SourcePropertyName (AboutText) is the name of the property that will be the source of the value

    Note that Mvx uses Properties – not fields – so private string StringTemp {get;set;} is bindable, but private string StringTemp; is not.


    You could also do two-way binding for this string reference if you wanted to… but you would need to setup some custom binding information to do so – there would need to be some event fired and captured in order to update the ViewModel (I’ll leave that for another day!)


    For situations where direct binding isn’t what you are looking for, then you can always subscribe to PropertyChanged and handle the notifications in more verbose code… e.g.:

    ViewModel.PropertyChanged += (s,e) => 
    {
        if (e.PropertyName == "AboutText")
        {
             // do something complicated here with the new ViewModel.AboutText value
        }
    };
    

    …but I personally tend to avoid this type of code where I can…

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

Sidebar

Related Questions

This may sounds like a stupid question but can't find anything on google, probably
This probably sounds really stupid but I have noo idea how to implement jquery's
This probably sounds like a nightmare, but I'd really like to get this working.
This probably sounds like a stupid question, but I'm going to give it a
This probably sounds like a really dumb question, but here goes....Web Services, what the
At first, this question can sound really stupid, but it is not in fundamental.
This may sound really noobish, and I'm probably missing something really stupid.. But, I'm
This probably sounds like a terrible idea at first glance, but here is my
I know this probably really simple but Im not sure what im doing wrong...
This is probably a really obvious question, but it's driving me nuts. We have

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.