Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Talk:Data Binding to controls on Windows Phone

From Wiki
Jump to: navigation, search


Hamishwillee - Partial subedit

Hi Gargi

I've done some basic updates for English and wiki style (e.g. using Icode for inline code markup) and bold for filenames. I'll do some further updates to the English later.

What is covered is a) the basic syntax for creating an initial link between the XAML and code which will update the UI components after the page is loaded. b)how to ensure that if the code is subsequently updated the UI will respond. This is good, but it omits the fact that UI changes will not propagate to the object in code - ie only one way binding. I also think it would be useful to show how people can bind between two objects in XAML. Both of these are well covered in , and I'd create a SeeAlso that links to that too.

Now there are other interesting types of binding like binding a list, binding to something from an XML feed (perhaps using XPATH), binding to a database table. All of these are probably out of scope from this topic, but I'd say that adding links to wiki topics or MSDN data that covers them would be a very good idea.




hamishwillee 09:32, 11 September 2012 (EEST)

Gaba88 - Good Observations

Hello Hamish,

Yes you say a very good point of how model will be updated from UI, i feel to add something on that as soon as i get some time but indeed it will make the article complete.

Second thing is i am working on the binding between elements if the content is large enough i will create an article just to keep the abstraction otherwise i will edit the same article to show how elements can bind with each other, the link you have provided is good i will go through it for sure.

Now the third part whatever comes on my way which makes sense while binding model to the ui elements i will try to add that to see also for sure.



gaba88 16:48, 11 September 2012 (EEST)

Hamishwillee - Sounds good - subedited

Hi Gargi

Sounds like a good approach. I suspect that you will probably need a new article and cross link - not because its a very big topic, but because this topic could get quite long. Depending on what gets included we should probably update the name from "Data Binding For Windows Phone" to "Data Binding to controls on Windows Phone" or "Data Binding to controls from code using Windows Phone"

I've added a SeeAlso link to other good content on this topic. You might want to "poach" some sections from these - for example explain how to do simple data binding without specifying a bound value. I've alluded to this in my changes (search on ToString above) - basically if you don't specify a property of the bound value then the framework calls ToString to get the value for the whole bound object. I don't think its all that vital to cover this in detail.

I've given this a very good subedit and done a major restructure of the early sections (hope you're OK with that). The main change is to bring the XAML parts together and the C# bits together. That way the changes that need to be made are more obvious. I've also made an effort to explain the interesting bits of code - ie point out the key names and identifiers that make the linkage work. Also explained how it is that the property ContentPanel appears in C# code. Please check you're happy with that.

I think it should be relatively easy to add a short section on "making code 2 way".



hamishwillee 05:14, 12 September 2012 (EEST)

Gaba88 - Two Way Binding Added

Hello Hamish

I just finished adding the Two Way Binding code into the article and now i personally think that, the element binding should obviously go to the another article.



gaba88 20:43, 12 September 2012 (EEST)

Hamishwillee - Excellent - further updates

Hi Gargi

now i personally think that, the element binding should obviously go to the another article.


Thanks for that. I've renamed the article to better specify its scope, and given it another good subedit. The main reason for the changes were that we were actually not explaining the modes properly. My assumption was that the default binding mode was OneTime, when actually it is TwoWay, but you get OneTime behaviour if you don't implement INotifyPropertyChanged - but with worse performance.

So now this is changed to make it clear what the modes are at each point of the article. I also moved the mode explanation up into the introduction, and explained what they are there.

Hope you are happy. I think this is now on a par, or better than the MSDN content.



hamishwillee 03:47, 13 September 2012 (EEST)

SB Dev -

Well, in the end it's not really a OneTime binding in behavior. If you do OneTime the Control would update it's value once but not have anything more to do with the property. With OneWay the changing property would always update the control, but the control wouldn't update the property. If you define TwoWay without INotifyPropertyChanged you get only a single update of the control when setting it's DataSource but you would still have the property being updated whenever the control changes (which is quite likely for a TextBox).

Aside from that the information is equally valid for Windows Phone 8 (or any other XAML based UI like Windows 8 or WPF), so I updated the category accordingly.

SB Dev (talk) 21:19, 15 September 2013 (EEST)

Hamishwillee - Further updates required

Hi Oliver

Thanks. I've also deleted the platform, keywords and devicecompatibility values from the metadata - we don't use them anymore.

If the clarification you made about OneTime etc isn't captured in the article, please do so!



hamishwillee (talk) 10:09, 16 September 2013 (EEST)

SB Dev -

I adapted the according tip to reflect this behavior.

SB Dev (talk) 11:55, 16 September 2013 (EEST)

Hamishwillee - Looks good

Thanks very much.

hamishwillee (talk) 03:51, 17 September 2013 (EEST)

FeatApps - How to data bind the Audio in PlaySoundAction

How Do I Data Bind the Source of an Audio in PlaySoundAction in Windows Phone 8 C#.

I have a Panorama Template with Border Boxes.. All of the Borders are Data Bind..

How Do I assign different Audio files to each of the Border Box (that are data bind)

FeatApps (talk) 11:25, 24 March 2014 (EET)