Beispiel #1
0
        // <summary>
        // Basic ctor.  Note, however, that this class should only be created by ModelPropertyValueCollection
        // as that class ensures that the new instance is correctly added and removed from the
        // ModelItemMap.
        // </summary>
        // <param name="modelItem">ModelItem to wrap around</param>
        // <param name="index">Index of the ModelItem in the collection</param>
        // <param name="parentCollection">Parent collection</param>
        public ModelPropertyIndexer(
            ModelItem modelItem,
            int index,
            ModelPropertyValueCollection parentCollection)
            : base(parentCollection.ParentValue)
        {
            if (modelItem == null)
            {
                throw FxTrace.Exception.ArgumentNull("modelItem");
            }
            if (parentCollection == null)
            {
                throw FxTrace.Exception.ArgumentNull("parentCollection");
            }

            _modelItem        = modelItem;
            _index            = index;
            _parentCollection = parentCollection;
            _valueCache       = new CachedValues(this);
        }
        // <summary>
        // Basic ctor.  Note, however, that this class should only be created by ModelPropertyValueCollection
        // as that class ensures that the new instance is correctly added and removed from the
        // ModelItemMap.
        // </summary>
        // <param name="modelItem">ModelItem to wrap around</param>
        // <param name="index">Index of the ModelItem in the collection</param>
        // <param name="parentCollection">Parent collection</param>
        public ModelPropertyIndexer(
            ModelItem modelItem,
            int index,
            ModelPropertyValueCollection parentCollection)
            : base(parentCollection.ParentValue) 
        {

            if (modelItem == null)
            {
                throw FxTrace.Exception.ArgumentNull("modelItem");
            }
            if (parentCollection == null)
            {
                throw FxTrace.Exception.ArgumentNull("parentCollection");
            }

            _modelItem = modelItem;
            _index = index;
            _parentCollection = parentCollection;
            _valueCache = new CachedValues(this);
        }
            // Clear value-related things that this class caches
            public void ClearValueRelatedCacheItems() 
            {
                _subProperties = null;
                _collection = null;
                _standardValues = null;
                _standardValuesExclusive = null;
                _converter = null;
                _commonValueType = null;
                _source = null;
                _isReadOnly = null;
                _valueSerializer = null;

                ClearSubValueRelatedCacheItems();

                _parent.OnPropertyChanged("StandardValues");
                _parent.OnPropertyChanged("StandardValuesExclusive");
                _parent.OnPropertyChanged("Converter");
                _parent.OnPropertyChanged("CommonValueType");
                _parent.OnPropertyChanged("IsReadOnly");

                // The following properties are only exposed by ModelPropertyEntry, not PropertyEntry.
                // People should bind to these properties through the PropertyValue.
                // However, if they ---- up in Xaml, the binding will still work and if that happens
                // we should try to update them when things change.
                _parent.OnPropertyChanged("SubProperties");
                _parent.OnPropertyChanged("Collection");
                _parent.OnPropertyChanged("Source");
            }