public static void ApplyCustomizationsToRendering(BracketHighlightRenderer renderer, IEnumerable<Color> customizations) { renderer.UpdateColors(DefaultBackground, DefaultBorder); foreach (Color color in customizations) { //if (color.Name == BracketHighlight) { renderer.UpdateColors(color, color); // renderer.UpdateColors(color.Background ?? Colors.Blue, color.Foreground ?? Colors.Blue); // 'break;' is necessary because more specific customizations come first in the list // (language-specific customizations are first, followed by 'all languages' customizations) break; //} } }
public static void ApplyCustomizationsToRendering(BracketHighlightRenderer renderer, IEnumerable <Color> customizations) { renderer.UpdateColors(DefaultBackground, DefaultBorder); foreach (Color color in customizations) { //if (color.Name == BracketHighlight) { renderer.UpdateColors(color, color); // renderer.UpdateColors(color.Background ?? Colors.Blue, color.Foreground ?? Colors.Blue); // 'break;' is necessary because more specific customizations come first in the list // (language-specific customizations are first, followed by 'all languages' customizations) break; //} } }
/// <summary> /// Reset the <seealso cref="SolidColorBrush"/> to be used for highlighting the current editor line. /// </summary> /// <param name="newValue"></param> private void AdjustCurrentLineBackground(SolidColorBrush newValue) { if (newValue != null) { HighlightCurrentLineBackgroundRenderer oldRenderer = null; // Make sure there is only one of this type of background renderer // Otherwise, we might keep adding and WPF keeps drawing them on top of each other foreach (var item in this.TextArea.TextView.BackgroundRenderers) { if (item != null) { if (item is HighlightCurrentLineBackgroundRenderer) { oldRenderer = item as HighlightCurrentLineBackgroundRenderer; } } } this.TextArea.TextView.BackgroundRenderers.Remove(oldRenderer); this.TextArea.TextView.BackgroundRenderers.Add(new HighlightCurrentLineBackgroundRenderer(this, newValue.Clone())); // Remove reference to old background renderer instance (if any) and construct BracketRenderer from scratch if (this.mBracketRenderer != null) { this.TextArea.TextView.BackgroundRenderers.Remove(this.mBracketRenderer); this.mBracketRenderer = null; } this.mBracketRenderer = new BracketHighlightRenderer(this.TextArea.TextView); this.TextArea.TextView.BackgroundRenderers.Add(this.mBracketRenderer); } }