Can someone please point me to a working example of how I'm supposed to do data binding in Silverlight for Windows Embedded (SWE). I have seen a showcase of it, so it appears to be possible. And I've read here that I need to implement IXRPropertyBag to make it work, but have yet to find (working) instructions on how to do it.
Data binding in Silverlight for Windows Embedded (SWE)
1.8k views Asked by Kristoffer At
2
I managed to get data binding working between the
IsChecked
property of twoToggleButton
elements, based on the insanely bad example found in the help files that came with the WCE7 CTP. I would have expected to set the data context and data bindings in XAML, but the documentation told me to code it.First you have to create a class that implements
IXRPropertyBag
. Then you have to set the data context and data binding to an instance of this property bag from code.I'm sorry for the lack of a naming convention in the code, but it is still far better than the example that was provided by Microsoft. It is also not as generic as it could be, but I'll leave that refactoring up to you.
MyPropertyBag.h:
MyPropertyBag.cpp:
Create the shared property bag and call BindDataToControl for both toggle buttons before calling StartDialog on the visual host:
This is what BindDataToControl would look like, to set the DataContext and the binding: