Skip to main content

Microsoft Silverlight

Answered Question Access silverlight static property from javascriptRSS Feed

(0)

Booto
Booto

Member

Member

0 points

1 Posts

Access silverlight static property from javascript

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 Pinto
Wilfred ...

Participant

Participant

1318 points

258 Posts

Answered Question

Re: Access silverlight static property from javascript

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

Wilfred Pinto
http://projectsilverlight.blogspot.com


Please remember to mark the replies as answers if they help answer your question.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities