Пример #1
0
            private void SetState(IVirtualList list, QueuedBackgroundWorkerState loadingState)
            {
                if (list == List && loadingState == LoadingState)
                {
                    return;
                }

                List         = list;
                LoadingState = loadingState;
                var loadingIndicator = LoadingIndicator;
                var oldIsVisible     = loadingIndicator != null;
                var newIsVisible     = LoadingState != QueuedBackgroundWorkerState.Standby;

                if (oldIsVisible == newIsVisible)
                {
                    if (newIsVisible)
                    {
                        loadingIndicator.SetState(List, LoadingState);
                    }
                }
                else if (newIsVisible)
                {
                    AdornerManager.SetAdorner(_itemsControl, new VirtualListLoadingIndicator(List, LoadingState));
                }
                else
                {
                    AdornerManager.SetAdorner(_itemsControl, null);
                }
            }
Пример #2
0
            public void Dispose()
            {
                if (LoadingIndicator != null)
                {
                    AdornerManager.SetAdorner(_itemsControl, null);
                }

                if (_itemsControl != null)
                {
                    var dpd = DependencyPropertyDescriptor.FromProperty(ItemsControl.ItemsSourceProperty, typeof(ItemsControl));
                    dpd.RemoveValueChanged(_itemsControl, OnItemsSourceChanged);
                    _itemsControl = null;
                }
                if (_list != null)
                {
                    _list.LoadingStateChanged -= OnLoadingStateChanged;
                    _list = null;
                }
                _loadingState = QueuedBackgroundWorkerState.Standby;
                GC.SuppressFinalize(this);
            }