silverlight

Silverlight - Getting the Domain Information

眉间皱痕 提交于 2019-12-20 03:52:29
问题 How does a Silverlight application ask the browser what domain its being served up from? UPDATE: Make sure if your class doesn't already have this using statement add it at the top your class. This will help you on some of the examples you'll see online. It confused me for a bit. using System.Windows.Browser; 回答1: How about HtmlDocument.DocumentUri? That'd get you what you need. Page about browser interop here . 回答2: As jcollum says you access the HtmlDocument.DocumentUri property to get lots

Audio output from Silverlight

时间秒杀一切 提交于 2019-12-20 03:46:14
问题 I'm looking to develop a Silverlight application which will take a stream of data (not an audio stream as such) from a web server. The data stream would then be manipulated to give audio of a certain format (G.711 a-Law for example) which would then be converted into PCM so that additional effects can be applied (such as boosting the volume). I'm OK up to this point. I've got my data, converted the G.711 into PCM but my problem is being able to output this PCM audio to the sound card. I

Silverlight: Create image from silverlight controls

送分小仙女□ 提交于 2019-12-20 03:25:11
问题 Is it possible to generate an image from a silverlight control so that the control would render itself and its contents to an image so that I can do sime pixel manipulation on the image? 回答1: There is no way to achieve this in Silverlight 2. I have seen people work around this limitation by posting XAML to a server which would use WPF to render it to a bitmap (using RenderTargetBitmap) and return an image. However, the just released Silverlight 3 Beta includes a WritableBitmap class which can

Silverlight: HTTP DELETE and PUT methods with RestSharp

跟風遠走 提交于 2019-12-20 03:17:54
问题 I wanted to access an internal REST API from Silverlight, but it turns out that I am not allowed to use POST or DELETE as the HTTP method for my request. Doing so always resulted in a SecurityException . What is the recommended way to use REST apis with Silverlight? 回答1: SecurityException probably means the API doesn't have the proper clientaccesspolicy.xml file in place. Here's an example of a very lenient one that allows all HTTP methods and headers. We have used this successfully for our

Encoding.ASCII not available in Silverlight is there a alternative?

梦想与她 提交于 2019-12-20 03:17:15
问题 I have the following line of code for a Windows forms application: return Encoding.ASCII.GetBytes(chars.ToArray()); This line worked fine, but today I was trying my code on the Windows Phone/Silverlight framework and the: Encoding.ASCII Library does not exist there. Is there any (simple) way to do the same thing but with a Silverlight library? 回答1: Try using Encoding.UTF8 - Silverlight is unicode only. 回答2: Probably using Encoding.UTF8 will solve your problem, but you can always use the

Silverlight exception in ViewModel not caught in Application_UnhandledException

本秂侑毒 提交于 2019-12-20 03:06:41
问题 I have the following situation where an Exception thrown in a ViewModel does not bubble up to the Application_UnhandledException in App.xaml.cs. I have an ObservableCollection in the ViewModel bound to the ItemSourceProperty in a ComboBox. The SelectedItemProperty of the ComboBox is bound to a property in the ViewModel. When the users selects an entry in the ComboBox the property is correctly called in the ViewModel. A bit of logic is performed and another property (call it property2) is set

Making a WP7 HttWebRequest POST with an untrusted cert?

雨燕双飞 提交于 2019-12-20 02:56:44
问题 I'm working on a Windows Phone 7 application that makes a REST service call. The third party that hosts the web services has an invalid certificate in the current environment. When I hit the URL in Firefox, I get a warning about the cert and I am asked if I want to continue. I'm also using the Poster FF extension to test the call. It works with Poster if I first accept the invalid cert in Firefox. If I don't, then POSTER wont make the request. In my WP7 Emulator, I can't make the request at

Co-opting Binding to listen to PropertyChanged events without a FrameworkElement

喜夏-厌秋 提交于 2019-12-20 02:56:08
问题 I have some nested view models that implement INotifyPropertyChanged . I'd like to bind an event listener to a nested property path (e.g. "Parent.Child.Name" ), much like FrameworkElement dependency properties can be bound to arbitrary nested properties. However, I just want something like a PropertyChanged event listener -- I don't actually have any UI element I'd like to bind. Is there any way to use the existing framework to set up such an event source? Ideally, I shouldn't need to modify

FrameworkElement.Parent and VisualtreeHelper.GetParent behaves differently

巧了我就是萌 提交于 2019-12-20 02:29:54
问题 In a WP7 app, I used FrameworkElement.Parent recursively to determine whether a specific element is inside of another element. But it does not always work correctly. Then I changed my code to use VisualtreeHelper.GetParent method recursively, and it always work correctly(so far as I tested). So what is the difference of them? Thanks 回答1: Consider ControlA and ControlB where ControlA is a content control meaning it can contain other controls. <ControlA> <ControlB /> </ControlA> Logically the

How to register own protocol using the WebBrowser control?

爱⌒轻易说出口 提交于 2019-12-20 02:15:26
问题 In a WP7 Silverlight application with a WebBrowser control I want to use an own protocol like "myttp://" to deliver some local content. I can't use Navigate() to an IsolatedStrorage because some content will by created on demand. For the same reason NavigateToString() is also not usable for me. I tried to register a WebRequestCreator descend for my MYTP protocol myCreator = new MyRequestCreator(); WebRequest.RegisterPrefix("mytp://", myCreator); but it isn't called from the browser control if