Note that there are some explanatory texts on larger screens.

plurals
  1. POBinding resource data to custom winjs control
    primarykey
    data
    text
    <p>I am trying to create a custom placeholder control. Here is the code excerpt:</p> <pre><code>(function () { var Placeholder = WinJS.Class.define(function ctor(elem, options) { this.element = elem || document.createElement('div'); this.element.winControl = this; WinJS.UI.setOptions(this, options); this.init(); }, { element: { get: function () { return this._element; }, set: function (value) { this._element = value; } }, placeholder: { get: function () { return this._placeholder; }, set: function (value) { this._placeholder = value; this._placeholderElement.textContent = value; } }, placeholderClass: { get: function () { return this._placeholderClass; }, set: function (value) { this._placeholderClass = value; this._placeholderElement.classList.add(value); } }, _placeholderElement: null, init: function () { this._addPlaceholder(); }, _addPlaceholder: function () { /* Code to add placeholder. */ } }); WinJS.Namespace.define("ControlX", { Placeholder: Placeholder }); })(); </code></pre> <p>I am trying to use this control in the html in this manner :</p> <pre><code>&lt;div data-win-control="ControlX.Placeholder" data-win-res="{winControl:{placeholder:'resHeight'}}"&gt;&lt;input type="text"/&gt;&lt;/div&gt; </code></pre> <p>When I set the placeholder value using the <code>data-win-res</code> attribute, I am getting an exception: </p> <blockquote> <p>"Unable to set property 'placeholder' of undefined or null reference"</p> </blockquote> <p>According to this article: <a href="http://msdn.microsoft.com/en-us/library/windows/apps/jj673579.aspx" rel="nofollow">How to localize WinJS controls</a> we can bind resource strings to winControl attributes too.</p> <p>What am I doing wrong?</p> <p>Is there any other way to bind resource string to a winControl property?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload