[WP8 Development] Solution for Wincontrol or Itemdatasource value NULL in WINJS

Source: Internet
Author: User

In the process of developing with WINJS, such as adding a pivot control, adding pivotitem1,pivotitem2 ...

Execute the corresponding PivotItem statement in the JS file, you will find such a situation:

PivotItem1 is the first time the program starts to render the elements in the interface, and ITEM2, ITEM3 has not been initialized, this time if the simple JS in the data binding Item2, Item3 value,

The "0x800a138f-javascript runtime error:unable to set property ' Itemdatasource ' of undefined or null reference" appears.

This time by adding breakpoints debugging only found that the control of the Wincontrol is undefined, so xxx.winControl.itemDataSource certainly also for undefined.

Then you need to initialize the PIVOTITEM2, 3 control first, which solves the problem of Wincontrol as undefined:

// Original JS: var glistv = document.getElementById ("Guidelistview"= data.datasource; // to be replaced by: var glistv = document.getElementById ("Guidelistview"); WinJS.UI.processAll (GLISTV). Then (function  dataBinding () {    = data.datasource;});

[WP8 Development] Solution for Wincontrol or Itemdatasource value NULL in WINJS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.