Пример #1
0
        protected override void OnItemCountChangeRequested(PackedGridExample adapter, int newCount)
        {
            base.OnItemCountChangeRequested(adapter, newCount);

            _CurrentFreeID = 0;
            adapter.LazyData.ResetItems(newCount);
        }
Пример #2
0
        // Just a hack to force an entire refresh of the adapter, as if it was first initialized.
        // This is needed because some properties are only read at initialization, but we want to force
        // their value to be read & the entire view updated at each press of this toggle
        void ForceReinitializeKeepingModels(PackedGridExample adapter)
        {
            var originalData = adapter.LazyData;

            // Resetting to 0 count clears everything, including visible items, so nothing will be recycled
            adapter.LazyData = new DataHelpers.LazyDataHelper <BasicModel>(adapter, null);
            adapter.ResetItems(0);

            // Do recalculations since layout values could've beed changed
            adapter.Parameters.PrepareForInit(false);
            adapter.Parameters.InitIfNeeded(adapter);

            // Set back the original data and update the view
            adapter.LazyData = originalData;
            adapter.LazyData.NotifyListChangedExternally();
        }