Quantcast
Channel: Coding4Fun Blog - Channel 9
Viewing all articles
Browse latest Browse all 453

Opening XAML Behaviors

$
0
0

While this news is a couple months old it's still very pertinent and shows Microsoft's continued journey down the open source path

XAML Behaviors, open source and on UWP

Your requests to grow the XAML Behaviors platform and bring them forward to support UWP app development have been heard. Today we announce the next step: XAML Behaviors natively supported for UWP and shipping as a NuGet package (for both native and managed projects). Additionally, to build a vibrant community around the platform, Behaviors are open source and on GitHub. Now, you can help influence the future direction of Behaviors.

The History of Behaviors

Originally released for WPF and Silverlight, and based on the concept of EventTriggers in WPF, designers and developers used Behaviors as an easy means for rapidly building their apps while promoting code reuse. Behaviors encapsulate reusable functionality for elements which could be easily added to XAML without the need for more imperative code.

...

What are Behaviors and Actions?

Using both Behaviors and Actions, developers can create a wide variety of interactive scenarios.

Behaviors are attached to a control or element and listen for something to happen. What that “something” is can vary from an event firing (like a mouse click) or some data changing (as when a slider is moved to change a value). When the event the Behavior was listening for happens, it triggers one or more Actions.

Actions are invoked by Behaviors and execute on a selected element or control. Some examples of Actions can range from calling a method, navigating to another page, or triggering a storyboard.

Behaviors can be seen as event listeners and handlers. The following markup listens for a button to be clicked in order to play a storyboard:

...

Why are we open sourcing?

From adoption in popular frameworks to demand on UserVoice, it is clear that you want Behaviors to be bigger. It’s exactly because of this excitement that we want to open source Behaviors. Releasing as a NuGet package and hosting all Behaviors code on GitHub will allow new features and fixes to be addressed more quickly. When a new Behavior or feature is added to the repo, it can be consumed and used almost immediately. Opening up to contributions lets the Behaviors platform grow by empowering the community to set the pace and direction.

Open source model

Here’s our plan to build a vibrant community around Behaviors and open up the code.:

  1. Release cadence ...
  2. Contribution model ...
  3. Integration into Blend ...
...

Philosophy and direction

Behaviors will evolve as developers contribute to the project. However, not all pull requests will be accepted and merged into the repo. Here are the four philosophy and goals for Behaviors that we hope will help guide the types of contributions we receive.

  1. Targeting common interactive scenarios ...
  2. Writing good documentation and samples ...
  3. Concentrating on the SDK and not on the tooling ...
  4. Co-evolving C++ Behaviors evolve instep ...

What can I do?

Start using Behaviors now. If you previously referenced the Behaviors Extension SDK, please download and install the NuGet package and reference that. The NuGet package ships with the exact same namespace and API as the original Extension SDK in most cases, so switching over is easy. While the Extension SDK will still be supported, further development will only be pursued in the NuGet version.

Additionally, with the release of the NuGet package, some partnering frameworks are simultaneously shipping updates that support the new Behaviors package: Caliburn.Micro and Cimbalino Toolkit now leverage the new Behaviors. Check them out!

Conclusion

The XAML Behaviors that you know and love from building 8.1 apps are now ready for UWP, open source, and shipped as a NuGet package. Contributions of new and useful Behaviors are always welcome and encouraged.

I’d like to extend a big thank you to our MVP leaders for dedicating their time and effort to this cause and helping to guide this project as Behaviors are opened to the community.

Visit the GitHub page to learn more. If you have feedback, suggestions, or comments we’d love to hear them! Tweet using #BehaviorsGoOpenSource. Share what where you’d like Behaviors to go by submitting issues on the GitHub page or email.

[Click through for the entire post]

So is the project really alive? Well the latest commit was 6 days ago from the writing of the post... :)

Microsoft/XamlBehaviors

image

XAML Behaviors

XAML Behaviors is an easy-to-use means of adding common and reusable interactivity to your Windows UWP applications with minimal code. It is available for both native and managed applications. Use of XAML Behaviors is governed by the MIT License

Getting Started

Where to get it

Resources

More Info

Code Example

For an example of using Behaviors in an application, here is a snippet of XAML:

...

Building Behaviors from Source

What You Need ...




Viewing all articles
Browse latest Browse all 453

Trending Articles