Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Conditional ToolbarItem

$
0
0

Howdy from Austin Texas,

You know us Texans, we are friendly, but armed ;)

Anywho, I'm creating a Xamarin.Forms Mobile app for Droid and iOS, Xaml MVVM pathway. On one of my Xaml pages, I have a ToolbarItem "Submit". Sometimes this view is just read only, sometimes it is in data entry mode. When its read only, I want to disable/hide/remove the ToolbarItem as easily as possible and visa versa when its in data entry mode. The Xamarin.Forms documentation for ToolBarItem is light to say the least. Its says that ToolbarItem is inherited from menuitem, but that link is broken, I reported that to support. Object Viewer says its inherited from BindableObject. I've tried, with no luck, to use "IsVisible" and "Enabled" properties, setting those through my ViewModel.

Feel like there has to be an easy way to do this, but maybe not. I only have 1 ToolbarItem for this page, but I'm attempting to keep everything about this on the ViewModel, so I'm hoping to avoid having to get into the Xaml.cs and do ToolbarItem.Clear().

Anyone have an easy solution for me? If not and I have to get into the xaml.cs to add and remove ToolbarItems, any sample code would be appreciated.

Thanks!


Viewing all articles
Browse latest Browse all 58056

Trending Articles