How to use Silverlight objects in web service?
I'm developing a web application that is supposed to display a HUGE amount of vector data using Silverlight on client side. Imagine something l开发者_StackOverflow社区ike google maps but using vector graphics only, so DeepZoom is not an option.
I was planning to generate a huge XAML in web service and then return only small regions to clients using built-in SL Clip
and VisualTreeHelper
methods. The problem is that I'm unable to instantiate Silverlight objects (e.g. Canvas) inside web service!
Of course I can create XAML strings programmatically, but I'm losing SL clipping capabilities and code becomes much harder to create and maintain.
I found a temporary workaround: Silverlight objects can be created in another thread with ApartmentState.STA
option set. But it raises more problems with inter-thread communication and multiple user requests, so I cannot mark this as final answer.
精彩评论