silverlight

Detecting DataContext changed in Silverlight

守給你的承諾、 提交于 2019-12-23 11:47:03
问题 I have a multi-part question: (1) Is there a good reason why Silverlight doesn't expose a DataContextChanged event? It seems like a whole lot of hassle could be avoided if someone at Microsoft just changed internal to public in the FrameworkElement class (like WPF does). (2) I've found one or two different methods for hacking your way into a DataContextChanged event by using DependencyProperties in one configuration or another. But I can't get them to work reliably. My testing so far seems to

What's the most elegant workaround for the lack of DefaultFileName in SaveFileDialog in Silverlight?

十年热恋 提交于 2019-12-23 10:58:20
问题 The SaveFileDialog in Silverlight lacks a DefaultFileName property, resulting in the user having to enter the file name manually with every file download from a Silverlight application. This is very annoying and there's a lot of criticism about this, see the Silverlight forum. My question is: what is the most elegant way to get around this? 回答1: Prepare the download and let aspx handle the download for you: http://strugglesofacoder.blogspot.com/2011/03/alternative-to-saving-file-in.html 回答2:

KeyNotFoundException info

不想你离开。 提交于 2019-12-23 10:54:49
问题 I have an C# Silverlight application that is randomly throwing a " KeyNotFoundException ". I have no idea what key cannot be found. This has lead me to two questions: Does a KeyNotFoundException store/expose what key it tried to find? When I looked in the documentation, I did not see anything that implied this information was available. I am catching/logging this exception in a general Application.UnhandledException event handler. My question is, if I catch the event here, can I convert the

KeyNotFoundException info

最后都变了- 提交于 2019-12-23 10:54:12
问题 I have an C# Silverlight application that is randomly throwing a " KeyNotFoundException ". I have no idea what key cannot be found. This has lead me to two questions: Does a KeyNotFoundException store/expose what key it tried to find? When I looked in the documentation, I did not see anything that implied this information was available. I am catching/logging this exception in a general Application.UnhandledException event handler. My question is, if I catch the event here, can I convert the

Silverlight: Modal ChildWindow keeps parent grayed after closing

旧街凉风 提交于 2019-12-23 10:53:22
问题 When my modal ChildWindow closes, the parent control does not get "un-grayed" and all user input is blocked, forcing me to restart the application. Exact scenario which causes this behavior consistently: ChildWindow A pops up and user clicks a custom button on the bottom of the window (instead of OK or Cancel). My code does some work and then calls the Close() method for the ChildWindow. ChildWindow A closes and functionality is restored to parent control (controls are un-grayed). User causes

Is it possible to implement ping on windows phone 7?

元气小坏坏 提交于 2019-12-23 10:49:25
问题 To get the impression of networking capabilities in WP7 I was going to build a simple ping app that would display the result of ICMP ping request to a certain host. However, not only the System.Net.NetworkInformation.Ping class is missing, System.Net.Sockets namespace is missing as well. After a short research I found out that there are only two ways of communication in WP7: WebClient class that works with http(s) requests and WCF-client that works with SOA services. Does that mean that I can

Automatic Smooth Resize Transitions - A Problem with Storyboards

安稳与你 提交于 2019-12-23 10:25:29
问题 I have been trying for some time to create a class/series of classes that, upon detecting a resize in a related object, attempts to halt the resize of the object and create a smooth resize animation for it. However, I have always had a problem with the objects 'flickering' on the screen for a second at the target size before the animation kicks in. Long story short, after some serious debugging and self-doubt, I am under the impression that calling Storyboard.Begin() does not affect the

Automatic Smooth Resize Transitions - A Problem with Storyboards

落爺英雄遲暮 提交于 2019-12-23 10:23:58
问题 I have been trying for some time to create a class/series of classes that, upon detecting a resize in a related object, attempts to halt the resize of the object and create a smooth resize animation for it. However, I have always had a problem with the objects 'flickering' on the screen for a second at the target size before the animation kicks in. Long story short, after some serious debugging and self-doubt, I am under the impression that calling Storyboard.Begin() does not affect the

How to get general ItemContainer type for WPF ItemsControl

拟墨画扇 提交于 2019-12-23 10:17:56
问题 I want to determine ItemContainer type from an existing ItemsControl object. var item = control as ItemsControl; //HOW to get child container Type? Example how blend does this: Blend somehow determines that current TabControl type child item is TabItem . How to do same thing in code? 回答1: There is a StyleTypedPropertyAttribute on most classes derived from ItemsControl . Get the one having Property equals to "ItemContainerStyle" . The StyleTargetType property on this attribute should give you

Can I use Silverlight's WriteableBitmap to save non-visible parts of my UI to a bitmap?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 10:09:36
问题 Say I have some grid that you need to scroll down to see all of its lines, and I'm interested in saving some lines that are not currently visible as a bitmap. Is it feasible, or do I have to actually scroll down, "take a snapshot", and then scroll up again? This is a feasibility question, and thus I don't have code to share. 回答1: Yes. You can render any UIElement (and its children) to a writeable bitmap. When you do that you also specify a transform. That means you can display any part of the