In my general code blog I talked about usage of dynamic keyword in Silverlight browser interaction applications.Here is the sample with source.
Generally the browser interaction is used to communicate with the browser elements from Silverlight application.Its not at all type safe.So we use the general methods like SetProperty to talk to the com objects.
The 'innerText' property isn't defined at compile-time - it's a Javascript property on the div. The way to do this without the dynamic keyword is:
var myDiv = HtmlPage.Document.GetElementById("myDiv");
myDiv.SetProperty("innerText", "Text was replaced!");
We can replace the SetProperty as the real property usage if we use the dynamic keyword.
dynamic myDiv = HtmlPage.Document.GetElementById("myDiv");
myDiv.innerText = "Text was replaced!";
Download the sample from here
No comments:
Post a Comment