Is there a way to pass an array or List<> from the aspx.cs to xaml.cs?
+2
A:
the only way to pass data from your aspx hosting the control to your silverlight control is using InitParams which is a dictionary. try concating your string array using some predefied separator which you set on the InitParams and split again in the silverlight control.
update
string data = string.Join("[SEP]", strList);
string InitParams = "data=" + data;
you can embed this InitParams string into your object tag. pass this via InitParams. in your silverlight application
string[] data = e.InitParams["data"].Split("[SEP]");
Vinay B R
2010-10-03 03:36:02
@vinay i figured out how to pass single variables then parse them on the xaml.cs side, but how do you send a list/array or object?
cfarm54
2010-10-03 05:10:06
i have updated my answer
Vinay B R
2010-10-03 05:54:09
@vinay awesome i'll try it out. I'm assuming that string.Join works when you pass in a List<double> also?
cfarm54
2010-10-03 06:20:15
Do you know how to do this with a List<double>?
cfarm54
2010-10-03 06:31:26
InitParams can only take strings so might have to convert your List<double> to list<string> in aspx and convert it back in xaml
Vinay B R
2010-10-03 07:03:37
@vinay interesting. why is your second portion of code in an event handler? if so, what is the event handler you're calling? thx
cfarm54
2010-10-05 08:00:23
e is application start up event args in your silverlight application
Vinay B R
2010-10-05 09:01:07