Things I Think Are Cool: Behaviors Library
Things I Think Are Cool is a blog series where I talk about things I have found interesting and helpful. They can be time savers, productivity tools, podcasts, books, products, or even people.
A couple of weeks ago I wrote about an Event to Command Behavior developed by David Britch of Xamarin.
It's a single class that allows any event on a control to be bound to a Command. That's pretty cool.
Upon publishing that post, Norman Mackay reached out to me on Twitter to let me know about an entire library that Britch wrote, with similar - but expanded functionality.
This library has a ton of useful behaviors in it, and that's the topic of this week's Things I Think Are Cool: Behaviors Library for Xamarin.Forms
Why It's Cool
Adding a behavior to a control to allow an event on that control to invoke a Command is neat - and useful.
This library though takes that notion and extends it to the next logical step ... and beyond.
It contains behaviors to listen for data changes and then invoke a Command ... and another one that invokes an action on a specified object whenever an event fires.
There are a set of behaviors to set properties on a given control or binding based on events firing on a control or data changing.
And then - and maybe the coolest - in addition to invoking a command or action or setting a property ... there are a set of behaviors that enable animations to be run on any control whenever an event occurs or data changes to the behavior's control!
In other words, you can now setup Xamarin.Forms animations in XAML!
All the animations are there, and you can compose together several to run in sequence ... so for example, first a translate animation runs followed by a fade in response to a button click event.
All in all, this is a great library to add to your toolbox.
How To Get It
The library can be downloaded and installed from NuGet here.
But, if you'd rather see the code of how this is all done, and why wouldn't you, the GitHub repo is here.
And an introduction to the library can be found on David Britch's blog.