コード例 #1
0
        void OnGroupingEnabledChanged()
        {
            if (CachingStrategy == ListViewCachingStrategy.RecycleElement)
            {
                _templatedObjects.Clear();
            }

            OnItemsSourceChanged(true);

            if (!IsGroupingEnabled && _shortNames != null)
            {
                _shortNames.Dispose();
                _shortNames = null;
            }
            else
            {
                OnShortNameBindingChanged();
            }
        }
コード例 #2
0
        void OnShortNameBindingChanged()
        {
            if (!IsGroupingEnabled)
            {
                return;
            }

            if (GroupShortNameBinding != null && _shortNames == null)
            {
                _shortNames = new ShortNamesProxy(this);
            }
            else if (GroupShortNameBinding == null && _shortNames != null)
            {
                _shortNames.Dispose();
                _shortNames = null;
            }

            if (_groupedItems != null)
            {
                if (GroupShortNameBinding == null)
                {
                    foreach (TemplatedItemsList <TView, TItem> list in _groupedItems.Values)
                    {
                        list.SetValue(ShortNameProperty, null);
                    }

                    return;
                }

                foreach (TemplatedItemsList <TView, TItem> list in _groupedItems.Values)
                {
                    list.SetBinding(ShortNameProperty, GroupShortNameBinding.Clone());
                }
            }

            if (_shortNames != null)
            {
                _shortNames.Reset();
            }
        }