Friday, December 21, 2007

Adventures in silverlight

Typically when you are downloading XAML to show in your silverlight application, you would use a downloader and call createFromXamlDownloader.
This takes the XAML content that the downloader has downloaded and parse that into a XAML tree which you can then paste into your object hierarchy.
Here is the rub: if your downloaded XAML has event handlers for anything other than Loaded or OnLoad, and you are trying to wire it up to a javascript that you have linked in your original pages, you are in for a surprise. the events dont fire or if they do, they dont seem to call the script handlers correctly.
This may be a security thing - i am not sure. maybe you can wire handlers only to script that you have downloaded in the same downloader? Who knows.
Anyways, the only way i seem to get it to work is by getting the responsetext from the downloader and calling CreateFromXAML with that text.

All is well that ends well.

No comments: