public Text() { LabelBox = new LabelBox(); _style = new TextStyle(); _style.PropertyChanged += _style_PropertyChanged; }
private void Cascade(TextStyle text) { var missing = (text.Fields | text.InheritedFields) & ~Fields; if (missing == TextStyleFields.None) return; foreach (TextStyleFields fields in Enum.GetValues(typeof(TextStyleFields))) if (missing.HasFlag(fields)) switch (fields) { case TextStyleFields.Font: _font = text.Font; OnNotifyPropertyChanged("Font"); break; case TextStyleFields.Angle: _angle = text.Angle; OnNotifyPropertyChanged("Angle"); break; case TextStyleFields.ScaleX: _scaleX = text.ScaleX; OnNotifyPropertyChanged("ScaleX"); break; case TextStyleFields.ScaleY: _scaleY = text.ScaleY; OnNotifyPropertyChanged("ScaleY"); break; case TextStyleFields.Opacity: _opacity = text.Opacity; OnNotifyPropertyChanged("Opacity"); break; case TextStyleFields.Overlappable: _overlappable = text.Overlappable; OnNotifyPropertyChanged("Overlappable"); break; case TextStyleFields.AllowOverlap: _allowOverlap = text.AllowOverlap; OnNotifyPropertyChanged("AllowOverlap"); break; case TextStyleFields.Alignment: _alignment = text.Alignment; OnNotifyPropertyChanged("Alignment"); break; case TextStyleFields.Color: _color = text.Color; OnNotifyPropertyChanged("Color"); break; case TextStyleFields.Size: _size = text.Size; OnNotifyPropertyChanged("Size"); break; case TextStyleFields.Content: _content = text.Content; OnNotifyPropertyChanged("Content"); break; case TextStyleFields.KeepUpward: _keepUpward = text.KeepUpward; OnNotifyPropertyChanged("KeepUpward"); break; } InheritedFields = missing; }