private void SetIndicator(TabHost.TabSpec tabSpec, object item)
        {
            (item as IViewModel)?.Settings.Metadata.AddOrUpdate(ViewModelConstants.StateNotNeeded, true);
            var templateId = _itemTemplateProvider.GetTemplateId();
            var selector   = _itemTemplateProvider.GetDataTemplateSelector();

            if (templateId == null && selector == null)
            {
                selector = EmptyTemplateSelector.Instance;
            }
            object content = AndroidToolkitExtensions.GetContentView(TabHost, TabHost.Context, item, templateId, selector);

            if (content == EmptyTemplateSelector.EmptyView)
            {
                content = null;
                if (item is IHasDisplayName)
                {
                    BindingServiceProvider.BindingProvider.CreateBindingsFromString(tabSpec, "Title DisplayName", null);
                }
                else
                {
                    tabSpec.SetIndicator(item.ToStringSafe("(null)"));
                }
            }
            var view = content as View;

            if (view == null)
            {
                tabSpec.SetIndicator(content.ToStringSafe("(null)"));
            }
            else
            {
                tabSpec.SetIndicator(view);
            }
        }
        public override int GetItemViewType(int position)
        {
            if (ItemsSource == null)
            {
                return(Adapter.IgnoreItemViewType);
            }
            var selector = _itemTemplateProvider.GetDataTemplateSelector() as IResourceDataTemplateSelector;

            if (selector == null)
            {
                return(0);
            }
            if (_resourceTypeToItemType == null)
            {
                _resourceTypeToItemType = new Dictionary <int, int>();
            }
            var id = selector.SelectTemplate(GetRawItem(position), _container);
            int type;

            if (!_resourceTypeToItemType.TryGetValue(id, out type))
            {
                type = _currentTypeIndex++;
                _resourceTypeToItemType[id] = type;
            }
            return(type);
        }
 private object GetContent(object item)
 {
     return(PlatformExtensions.GetContentView(TabHost, TabHost.Context,
                                              item, _contentTemplateProvider.GetTemplateId(), _contentTemplateProvider.GetDataTemplateSelector()));
 }