silverlightdata-bindingscriptable

silverlight databinding not working from scriptable member


We have exposed a silverlight page as a scriptable object. It has one scriptable member. The page's datacontext is a viewmodel object, of typ TestViewModel with one property string Description. The TestViewModel implements INotifyPropertyChanged. The page has a textbox bound to this Description property

When Description is set to some value from within method marked with the ScriptableMember attribute, the textbox does not change

I also have a button. When I set the Description property from the click event handler of the button, the textbox changes on my page, showing the correct value.

Any reason why databinding does not work from a scriptable member and if there is a way to make it work?


Solution

  • You have to make sure that "HtmlPage.RegisterScriptableObject(string scriptKey, object instance)" is set on the right place. Place it in the constructor of the xaml.cs of the page where the method with the ScriptableMember attribute is used.