I am trying to bind to a component built in C# - one of the class members implements IObservableVector:
public sealed class Class1
{
public Class1() {...}
public String MyString { get { ...} set {...} }
public IObservableVector<object> MyVector
{
get
{
return (IObservableVector<object>)this._myObservableVector;
}
}
private MyObservableVector<object> _myObservableVector;
}
My HTML template:
<div>
<h2 data-win-bind="textContent: myString WinJS.Binding.oneTime"></h2>
<h2 data-win-bind="textContent: myVector WinJS.Binding.oneTime"></h2>
<div data-win-control="WinJS.UI.ListView" data-win-bind="itemDataSource: myVector WinJS.Binding.oneTime" ></div>
</div>
and the javascript code:
var bindingSource = null;
app.onactivated = function (args) {
...
bindingSource = WindowsRuntimeComponent.CSharp.Class1();
args.setPromise(WinJS.UI.processAll().then(function () {
WinJS.Binding.processAll(document.rootElement, bindingSource);
})
The content in the first two items is correctly databound, but the ListView is empty. What am I missing? I've tried all sorts of permutations like switching to an ObservableCollection<> and sending back an IList<>, creating a bindable proxy via
WinJS.Binding.as(bindingSource), etc.
I found a couple of related forum posts but neither provided the insight I was looking for.
http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/f53f4a19-6a32-41af-8933-2d115f2bcd24
http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/38387326-8d81-48d1-8f85-023b9ebf2382
- Tom