I'm struggling to pass an array of strings from a Silverlight application to a Javascript function. Despite my efforts, I am only able to retrieve the first element of the array instead of the entire array. Here's a simple representation of the issue:
Silverlight:
string[] Names = new string[5];
Names[0] = "Test1";
Names[1] = "Test2";
Names[2] = "Test3";
Names[3] = "Test4";
Names[4] = "Test5";
HtmlPage.Window.Invoke("PopulateNames", Names);
Javascript:
function PopulateNames(names)
{
window.alert(names);
}
With the current code, I can only see "Test1" displayed, or "undefined" if I modify window.alert(names) to window.alert(names[0]).
If anyone has insight on how I can successfully pass all elements of the array to the Javascript function, please share your knowledge.