コード例 #1
0
        /// <summary>
        ///     Adds the data error information.
        /// </summary>
        /// <param name="dataErrorInfo">The data error information.</param>
        public void AddDataErrorInfo(DataErrorInfo dataErrorInfo)
        {
            if (dataErrorInfo.DataErrorInfoType != DataErrorInfoType.ObjectLevel)
            {
                foreach (var propertyName in dataErrorInfo.Properties)
                {
                    ValidatePropertyExists(propertyName);
                }
            }

            _dataErrorInfoCollection.Add(dataErrorInfo);
        }
コード例 #2
0
        /// <summary>
        ///     Removes the data error info.
        /// </summary>
        /// <param name="dataErrorInfo">The data error info.</param>
        public void RemoveDataErrorInfo(DataErrorInfo dataErrorInfo)
        {
            ISet <string> propertyNames = new HashSet <string> ();

            _dataErrorInfoCollection.Remove(dataErrorInfo);
            if (dataErrorInfo.DataErrorInfoType == DataErrorInfoType.ObjectLevel)
            {
                propertyNames.Add(string.Empty);
            }
            else
            {
                foreach (var name in dataErrorInfo.Properties)
                {
                    propertyNames.Add(name);
                }
            }
        }