Saturday, March 4, 2017

Xamarin Forms: ToolbarItem with Bindable IsVisible Property

It's fairly typical for toolbar items to change depending on the state of the model that the view is bound to (quite another thing if it's considered good UX).

Unfortunately Xamarin Forms doesn't have an IsVisible property on it's ToolbarItem control, so I had to hunt for a sample implementation.

A found this handy thread on the Xamarin forums.
Basically create a custom control that inherits from ToolbarItem, add a bindable IsVisible property, and add /remove the toolbar items as the property changes.

I made some minor modifications, and added the source code here

Happy Coding :)



No comments: