/// <summary> /// Initializes a new instance of the <see cref="EditorResources"/> class. /// </summary> /// <param name="properties">The <see cref="EditorProperties"/> to wrap.</param> public EditorResources(EditorProperties properties) { _properties = properties; _properties.CustomColorChanged += properties_CustomColorChanged; Background = new BrushResource(properties, EditorProperties.BackgroundProperty); Foreground = new BrushResource(properties, EditorProperties.ForegroundProperty); Selection = new BrushResource(properties, EditorProperties.SelectionProperty); LineNumber = new BrushResource(properties, EditorProperties.LineNumberProperty); FontName = properties.FontName; FontSize = properties.FontSize; _customBrushes = new TinyDictionary <int, Brush>(); var formattedText = new FormattedText("0", CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface(FontName), FontSize, Brushes.Black, VisualTreeHelper.GetDpi(new Button()).PixelsPerDip); CharacterWidth = formattedText.Width; CharacterHeight = (int)(formattedText.Height + 0.75); }
/// <summary> /// Initializes a new instance of the <see cref="BrushResource"/> class. /// </summary> public BrushResource(EditorProperties properties, ModelProperty editorProperty) { _editorProperties = properties; _editorProperty = editorProperty; }