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.
No comments:
Post a Comment