Unni's Blog

Design, Expression Blend, Silverlight, WPF, Windows Phone

...And another one - a Stocks widget

...And another one - a Stocks widget

  • Comments 19

Here is another attempt at a widget that I put togther in couple of hours last night - this lets you search for Stock quotes. This is fun stuff and easy to do - expect coolers ones from the many talented designers out there once WinFX and Expression Interactive Designer ship!

Two things to note: The OS that the application is being run on is not Windows Vista, it is the Feb. CTP of WinFX on Windows XP - I simply faked out the chrome for the window to look like the Aero glass one. Also, the text box behaves like the ones made popular by AJAX - it shows you a red highlight if the stock symbol that you entered is invalid by querying the Windows Live stock quotes service. If valid, it will show you the name of the company and a green highlight for the text box.

Feel free to download the source, and improve at will (excluding the content) from here. The code and design quality could have been a lot better, but I always run out of time at that point :).

Leave a Comment
  • Please add 7 and 4 and type the answer here:
  • Post
  • looks butt ugly
  • Nice use of the UsesPerPixelOpacity, however I would like to see a sample of using this with NavigationWindow. Any chance of sample that shows that?
  • Great example. I have a question: does UsesPerPixelOpacity="True" forces software rendering of the content?
  • Hi Valentin,

    Yes, it does.

    Courtesy Rob Relyea: That is the reason why Popup and HwndSource has this property that you can set on them, but Window does not

  • Hi Andy,

    Very good question - we should def. be able to make this thing more reusable - with this sample, I only took the first step.

    Another thing we were thinking when reviewing this sample was that it would be cool to write something like XmlHttpRequest made popular by Ajax so web-service queries can be easily processed in async fashion. We will post the results of our investigation...
  • I was very excited to see this, but now am a bit confused.  I am new to C# and .NET programming, so keep in mind these questions come from a background of considerable ignorance.

    I do not understand it completely, but the method used to achieve transparency here seems similar to the GadgetUI sample from the SDK.   Is this the only way to have translucent, invisible,  or custom window chrome and content?  

    I get the impression that this is somehow using old tech to make the new tech do what it should do in the first place.  Everything else about a WPF application GUI has numerous ways of altering its opacity (in XAML you can use Visible=, Opacity=, An OpacityMask, Transparency in the vectors graphics, or alter a parent element's opacity, etc.).  But when it comes to the Window itself things are, apparently, much more complicated.

    I'm not afraid to learn how this works, by any means, but am merely curious if this is, and will continue to be, the recommended method of achieving transparency in WPF desktop applications.
  • This is a way to fake transparency - I would highly recommend that you don't do it for a traditional application since this will force WPF to run in s/w rendering mode. I would think this is only practical for widgets and the like. If your goal is to just have not chrome and you are happy with rectangular windows, you can simply set a property on the Window class.

    I totally agree with you - I only wish there was a property on Window class to achieve this effect without writing any code or sub-classing Window. However, because of the s/w rendering gotcha, they don't have such a property on the Window class.
  • I was just playing with the code from this sample, converting the application code to vb for the per-pixel opacity. I am having an issue with a window with borders showing up in addition to my window with transparency. Any ideas?

    Also, from what I gather above there will not be any ability to create shaped or semi-transparent applications, hw rendered in this framework? That is a major bummer cause I've had so many ideas for how I was going to use that.
  • @ Corgalore: I guess your "Scene1" is still defined as the startup scene, thats the reason you getting the scene twice.

    @all: is there any easy way of making the form movable?
  • Hi Unnir,

    Very cool, but how to drag this program to move it?
  • why is it not running on my machine. I am getting this exceptions :

    System.IO.IOException was unhandled

     Message="Cannot locate resource 'scene1.baml'."


  • This is for hour the only program (Vystal for Windows 2000/XP) that simulates in way the much similar effect glass of Windows Vista: http://www.mpfweb.info/personalizzare/so.html

  • This is for hour the only program (Vystal for Windows 2000/XP) that simulates in way the much similar effect glass of Windows Vista. Direct Link of the constructor for having information:


  • Any assistance in getting this to drag would be greatly appreciated.

  • This is for hour the only program (FastAero for Windows 2000/XP) that simulates in way the much similar effect glass of Windows Vista. Direct Link of the constructor for having information: http://fastaero.wordpress.com/

    It seems better than Vystal

Page 1 of 2 (19 items) 12