From the course: Extending Xamarin with Behaviors, Commands, and Triggers

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

What is a Xamarin behavior?

What is a Xamarin behavior?

- [Narrator] What are behaviors? Behaviors are ways for you to interact with your controls in your app without cluttering your code. This is normative code that you would put in your code behind files. Behaviors also allow you to add this functionality without subclassing the visual element you're using. Now code behind files are traditional bulky, making them really hard to work with. Behaviors helps you clean up that code and make it easier to read and understand. It can be either be added in XAML files, code behind files, or in plain C# code. Behaviors are meant to deal with general patterns of functionality that you would give a visual element. For example, you may want to format dates, or make sure that only positive numbers are entered on an entry field. There are four different types of behaviors, but for this series we'll be focusing on forms and attached behaviors. Why use behaviors and what can they do for you in your app? The first thing is that your code is completely…

Contents