Jaime Rodriguez On Windows Phone, Windows Presentation Foundation, Silverlight and Windows 7
Say you are a hoster ( fake example: myspace) of some website where users create pages.. You will hopefully want to give them the ability to 'host silverlight' but want to restrict what they can script ( so they don't turn off your ads or messup the navigation) .. How to ??
In comes the 'internal script model' in silverlight ... Here is the 'gist' of how it works:
Note: you can have as many x:Code tags as you need, the x:Code tags must be children in the root Canvas.. the "type" and Source attributes are required.. x:Code can not be used from createFromXaml ..
Note:
<object id="ag" type="application/ag-plugin" height="340" width="390" ><param name="Source" value="sceneInternal.xaml"/><param name="MaxFrameRate" value="30" /><param name="OnError" value="default_error_handler" /> </object>
Live sample is here.. There is an "internal script version" and a non-sandboxed version... The difference shows when you left click on the MediaElement itself.. (one alerts, the other one throws error caught in try catch) .. Download the source here...
Disclaimers:
Great example.
Is there any way to place the JS inside the x:code via cdata block?
Why does inline xaml only allow you to reference xaml in <script> tags, why not <xml> tags?