private static void OnIsVisibleChanged(
            BindableObject bindable,
            object oldvalue,
            object newvalue)
        {
            BindableToolbarItem item = bindable as BindableToolbarItem;

            if (item != null && ((Element)item).get_Parent() == null || item == null)
            {
                return;
            }
            IList <ToolbarItem> items = ((Page)((Element)item).get_Parent()).get_ToolbarItems();

            if ((bool)newvalue && !((ICollection <ToolbarItem>)items).Contains((ToolbarItem)item))
            {
                Device.BeginInvokeOnMainThread((Action)(() => ((ICollection <ToolbarItem>)items).Add((ToolbarItem)item)));
            }
            else
            {
                if ((bool)newvalue || !((ICollection <ToolbarItem>)items).Contains((ToolbarItem)item))
                {
                    return;
                }
                Device.BeginInvokeOnMainThread((Action)(() => ((ICollection <ToolbarItem>)items).Remove((ToolbarItem)item)));
            }
        }
 private void InitVisibility()
 {
     BindableToolbarItem.OnIsVisibleChanged((BindableObject)this, (object)false, (object)this.IsVisible);
 }