Exemplo n.º 1
0
        void OnDataChanged()
        {
            InvalidateCount();
            if (ActionModeContext != null && !TemplatedItemsView.TemplatedItems.Contains(ActionModeContext))
            {
                CloseContextActions();
            }

            if (IsAttachedToWindow)
            {
                NotifyDataSetChanged();
            }
            else
            {
                // In a TabbedPage page with two pages, Page A and Page B with ListView, if A changes B's ListView,
                // we need to reset the ListView's adapter to reflect the changes on page B
                // If there header and footer are present at the reset time of the adapter
                // they will be DOUBLE added to the ViewGround (the ListView) causing indexes to be off by one.

                if (_realListView.IsDisposed())
                {
                    return;
                }

                _realListView.RemoveHeaderView(HeaderView);
                _realListView.RemoveFooterView(FooterView);
                _realListView.Adapter = _realListView.Adapter;
                _realListView.AddHeaderView(HeaderView);
                _realListView.AddFooterView(FooterView);
            }
        }