Showing posts with label WPF. Show all posts
Showing posts with label WPF. Show all posts

Monday, April 09, 2012

Reactive Extensions & WPF - Hiding mouse pointer when idle

Ever wanted to easily hide the mouse pointer after x seconds of idle activity in your WPF application? There are many ways to accomplish this, here is one way you might find useful: the MouseIdle Behavior extension.

This attachable behavior uses Reactive Extensions (Rx) to handle mouse movement and a normal DispatcherTimer to Control the interval routine.

Usage is as simple as adding the namespace to the declaration of your window:

xmlns:extensions="clr-namespace:Usoniandream.WPF.Extensions;assembly=Usoniandream.WPF.Extensions"

After that all you have to do is add the code to the interactivity block, like this:

 <i:Interaction.Behaviors>
        <extensions:MouseIdleBehavior
                TimeToIdle="3000" />
 i:Interaction.Behaviors>

The complete source is available for download at the following url: https://github.com/peterdrougge/Code-Samples/blob/master/WPF/Behaviors/MouseIdleBehavior.cs

Maybe you'll find this useful :)

P.

Sunday, July 01, 2007

WPF Showcase

I'm quite impressed by the Family.Show application written by the team at at Vertigo. it's cool, clever and uses a lot of the neat things you'll love in WPF like templates, resources, animations, bindings and a lot more. furthermore the code is really well documented and well written, so for anyone that want's to learn more about it it's a good application to check out. Family.Show info: http://www.vertigo.com/familyshow.aspx Family.Show source: http://www.vertigo.com/downloads/familyshow/FamilyShowSource.zip P.