WinRT ViewModel properties bound to a list RRS feed

  • Question

  • Hi there,

    I'm wondering if anyone can suggest a way to bind a C# WinRT component's class to a WinJS list in a one way manner.

    At the moment I have some read only properties in my WinRT class, such as this:

    public int CompositeNumber { get { if(this.aProp > 0) {

    return this.aProp1;

    } return this.aProp2; } }

    These are fine the first time round, but if I then want to update say aProp1 from my WinJS app, the listview property which is bound to 'CompositeNumber' will not respond to the change.

    To get round this, for some of the properties on my WinRT type I've explicitly set the in-memory values for say aProp3 in JS during user driven events, which updates the list as I'd want.

    Whilst this works, I'd much rather update the values through my C# and have those automatically drip down to the JS objects. I'd rather not update the JS objects and have those reflect in the C# side as I need to perform logical validation on the values before persisting them.

    Any thoughts would be greatly appreciated.

    Friday, July 5, 2013 7:46 AM

All replies