Posts Tagged ‘data binding’

Front End and Back End Synchronization in MCML

Sunday, April 19th, 2009

One of the issues that has been hardest for me to learn with developing media center applications as been the linking of front end items in the MCML layer with data that I have in c# on the back end. For a long time I struggled with binding values from the code in to front end, and making method calls from the front end in to the back end. I suspect that the reason I did this was because that is how it is shown in the Media Center SDK and documentation, so I thought it was the only way.

It turns out that the SDK is in fact showing the most complicated use case. There is a much easier way of linking the front end and the back end, that is so simple compared to the rest of MCML development that it’s almost non-intuitive. The technique is to create a UI item in your C# code, and then refer to that item on the front end. You don’t have two items, one front end and one back end. Instead you simply have one item that is referenced in both layers. That means that when you make a change to the value of the item in your C# code, the change is instantly reflected in the UI, and when you make a change to the value of the item in the UI, the C# code can reference that value instantly. Because it is the same physical item in memory. (more…)