Exemple #1
0
        private void OnEmptyTab()
        {
#if APPCOMPAT
            _actionBar.SetBindingMemberValue(AttachedMembersCompat.ActionBar.SelectedItem, BindingExtensions.NullValue);
#else
            _actionBar.SetBindingMemberValue(AttachedMembers.ActionBar.SelectedItem, BindingExtensions.NullValue);
#endif
            var value = ActionBarTemplate.GetTabContentId(_actionBar);
            if (value == null)
            {
                return;
            }
            _actionBar.ThemedContext.GetActivity()?.FindViewById <FrameLayout>(value.Value)?.RemoveAllViews();
        }
            public void OnTabSelected(ActionBar.Tab tab, FragmentTransaction ft)
            {
                if (_cleared)
                {
                    return;
                }
                var bar         = (ActionBar)tab.GetBindingMemberValue(AttachedMembers.Object.Parent);
                var placeHolder = ActionBarTemplate.GetTabContentId(bar);
                var activity    = bar.ThemedContext.GetActivity();

                SetContent(tab, ft, placeHolder, activity, bar);
                //Set selected item data context or tab
                var selectedItem = bar.GetBindingMemberValue(ItemsSourceGeneratorBase.MemberDescriptor) == null ? tab : tab.DataContext();

#if APPCOMPAT
                bar.SetBindingMemberValue(AttachedMembersCompat.ActionBar.SelectedItem, selectedItem);
#else
                bar.SetBindingMemberValue(AttachedMembers.ActionBar.SelectedItem, selectedItem);
#endif
            }