Skip to main content
Home Forums Silverlight Programming Programming with JavaScript Access silverlight static property from javascript
1 replies. Latest Post by Wilfred Pinto on October 19, 2009.
(0)
Booto
Member
0 points
1 Posts
10-19-2009 5:28 AM |
I have a static class in my Silverlight application called Options:
public static class Options { static Options() { Options.Filter = "test value"; } [ScriptableMember] public static string Filter { get; set; } }
With normal classes you can instantiate it and then RegisterScriptableObject("key", instance) to allow access from javascript. Is it possible to do the same with a static class?
My goal is to be able to get or set the static property filter from javascript.
Wilfred ...
Participant
1318 points
258 Posts
10-19-2009 7:06 PM |
At least in Silverlight 2, you couldn't register methods from a static class.
I don't know if this is changed in Siverlight 3 though.
edit: You could try a Singleton class if the static class doesn't work