Пример #1
0
        private IList <string> GetErrorsImpl(string propertyName)
        {
            var result            = new List <string>();
            var maxNumberOfShelfs = ElementDimension.MaximumNumberOfShelfs(this.Height);

            if (propertyName == NotificationObject.PropertyName(() => this.NumberOfShelfs))
            {
                if (this.NumberOfShelfs > maxNumberOfShelfs)
                {
                    result.Add(string.Format("Too many shelfs; maximum for this height is {0}", maxNumberOfShelfs));
                }
            }
            else if (propertyName == NotificationObject.PropertyName(() => this.Width))
            {
                if (this.Width != this.Parent.Width)
                {
                    result.Add("Width of item does not fit to width of element");
                }
            }

            return(result);
        }
Пример #2
0
        public string this[string columnName]
        {
            get
            {
                var maxNumberOfShelfs = ElementDimension.MaximumNumberOfShelfs(this.Height);
                if (columnName == NotificationObject.PropertyName(() => this.NumberOfShelfs))
                {
                    if (this.NumberOfShelfs > maxNumberOfShelfs)
                    {
                        return(string.Format("Too many shelfs; maximum for this height is {0}", maxNumberOfShelfs));
                    }
                }
                else if (columnName == NotificationObject.PropertyName(() => this.Width))
                {
                    if (this.Width != this.Parent.Width)
                    {
                        return("Width of item does not fit to width of element");
                    }
                }

                return(string.Empty);
            }
        }
Пример #3
0
 private void OnParentChanged(object _, PropertyChangedEventArgs ea)
 {
     this.RaiseErrorsChanged(NotificationObject.PropertyName(() => this.Width));
 }
Пример #4
0
 protected virtual void RaisePropertyChanged <T>(Expression <Func <T> > ex)
 {
     this.RaisePropertyChanged(NotificationObject.PropertyName(ex));
 }