Skip to main content
Home Forums Silverlight Programming Programming with JavaScript How to return javascript dictionary object to silverlight method ?
1 replies. Latest Post by swildermuth on August 27, 2008.
(0)
narzis
Member
7 points
7 Posts
08-19-2008 10:46 AM |
How can i javascript dictionary object in Silverlight?
Javascript code
function GetStatus(contacts) { var ht = {}; if (contacts.length) { for (var i=0; i < contacts.length; i++) { var foundContact = _communicatorObj.GetContact(contacts, _communicatorObj.MyServiceId); alert(contacts + ", " + foundContact.Status); ht[contacts] = foundContact.Status; } }
alert(ht.toString()); return ht;}
Silverlight
Dictionary<string, object> statusDic = HtmlPage.Window.Invoke("GetStatus", jsContacts) as Dictionary<string, object>;
statusDic is always null!
as i know, Javascript dictionaries can be converted to Dictionary<string, object>.
http://msdn.microsoft.com/en-us/library/cc645079(VS.95).aspx
How can i this?
swildermuth
Star
8320 points
1,546 Posts
08-27-2008 2:40 PM |
I think this is a bug in Beta 2. Hopefully it'll be fixed in the Release. I found this same behavior when I was writing a wrapper for GoogleGears.