public void OnTabSelected(ActionBar.Tab tab, FragmentTransaction ft)
            {
                if (_cleared)
                {
                    return;
                }
                var bar         = (ActionBar)tab.GetBindingMemberValue(AttachedMembers.Object.Parent);
                var placeHolder = ActionBarView.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
            }
            private void SetContent(ActionBar.Tab tab, FragmentTransaction ft, int?placeHolder, Activity activity, ActionBar bar)
            {
                if (placeHolder == null)
                {
                    Tracer.Error("The placeholder for tab {0} was not found.", tab);
                    return;
                }
                var layout = activity.FindViewById <ViewGroup>(placeHolder.Value);

                if (layout == null)
                {
                    Tracer.Warn("The ActionBarTabContentId with id = {0} is not found in activity {1}",
                                placeHolder.Value,
                                activity);
                    return;
                }
                if (_content == null)
                {
#if APPCOMPAT
                    _content = tab.GetBindingMemberValue(AttachedMembersCompat.ActionBarTab.Content);
#else
                    _content = tab.GetBindingMemberValue(AttachedMembers.ActionBarTab.Content);
#endif

                    var viewModel = _content as IViewModel;
                    if (viewModel == null)
                    {
                        var fragmentClass = _content as string;
                        //If content is a string, trying to create a fragment.
                        if (!string.IsNullOrEmpty(fragmentClass))
                        {
                            var type = TypeCache <Fragment> .Instance.GetTypeByName(fragmentClass, true, false);

                            if (type != null)
                            {
                                var fragment = Fragment.Instantiate(bar.ThemedContext, Java.Lang.Class.FromType(type).Name);
                                _content = fragment;
                            }
                        }
                        else if (_content is int)
                        {
                            _content = activity.GetBindableLayoutInflater().Inflate((int)_content, null);
                        }
                    }
                    else
                    {
                        viewModel.Settings.Metadata.AddOrUpdate(ViewModelConstants.StateNotNeeded, true);
                    }
                    _content = PlatformExtensions.GetContentView(layout, layout.Context, _content,
                                                                 _contentTemplateProvider.GetTemplateId(), _contentTemplateProvider.GetDataTemplateSelector());
                    if (BindingServiceProvider.BindingManager.GetBindings(tab, AttachedMembers.Object.DataContext).Any())
                    {
                        _content.SetBindingMemberValue(AttachedMembers.Object.Parent, tab);
                    }
                    layout.SetContentView(_content, ft, (@group, fragment, arg3) =>
                    {
                        if (fragment.IsDetached)
                        {
                            arg3.Attach(fragment);
                        }
                        else
                        {
                            arg3.Replace(@group.Id, fragment);
                        }
                    });
                }
                else
                {
                    layout.SetContentView(_content, ft, (@group, fragment, arg3) => arg3.Attach(fragment));
                }
            }