Freigeben über


...And another one - a Stocks widget

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 :).

Comments

  • Anonymous
    March 01, 2006
    The comment has been removed

  • Anonymous
    March 01, 2006
    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?

  • Anonymous
    March 02, 2006
    Great example. I have a question: does UsesPerPixelOpacity="True" forces software rendering of the content?

  • Anonymous
    March 02, 2006
    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

    Thanks!

  • Anonymous
    March 02, 2006
    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...

  • Anonymous
    March 09, 2006
    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.

  • Anonymous
    March 09, 2006
    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.

  • Anonymous
    March 12, 2006
    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.

  • Anonymous
    March 16, 2006
    @ 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?

  • Anonymous
    April 11, 2006
    Hi Unnir,

    Very cool, but how to drag this program to move it?

  • Anonymous
    March 31, 2007
    why is it not running on my machine. I am getting this exceptions : System.IO.IOException was unhandled  Message="Cannot locate resource 'scene1.baml'."  Source="PresentationFramework"

  • Anonymous
    April 23, 2007
    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

  • Anonymous
    May 16, 2007
    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: http://www.vystal.de.vu/

  • Anonymous
    July 03, 2007
    Any assistance in getting this to drag would be greatly appreciated.

  • Anonymous
    July 11, 2007
    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

  • Anonymous
    July 15, 2007
    TrueTransparency: Fast, simple, for all the PC and cards video. http://www.customxp.net/logitheque-134-1-telecharger-TrueTransparency.html For me the best one remains FastAero

  • Anonymous
    May 04, 2008
    The comment has been removed

  • Anonymous
    January 21, 2009
    PingBack from http://www.keyongtech.com/1062129-transparent-form

  • Anonymous
    June 19, 2009
    PingBack from http://mydebtconsolidator.info/story.php?id=17261