diff --git a/MultiTerm.Wpf.CustomControl/MultiFormatTextBox/MultiFormatTextBox.cs b/MultiTerm.Wpf.CustomControl/MultiFormatTextBox/MultiFormatTextBox.cs index 2f5c88a..62590ee 100644 --- a/MultiTerm.Wpf.CustomControl/MultiFormatTextBox/MultiFormatTextBox.cs +++ b/MultiTerm.Wpf.CustomControl/MultiFormatTextBox/MultiFormatTextBox.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using System.Linq; -using System.Runtime.CompilerServices; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; @@ -229,7 +228,7 @@ public class MultiFormatTextBox : Control // text as run with correct background brush run = new Run(formattedCharacter.Character) { - Background = this.currentlySelectedFormat!.BackgroundBrush + Background = this.GetBackgroundBrushForFormat(formattedCharacter.Format) }; } else if(item is SpacingCharacter spacingCharacter) @@ -410,4 +409,10 @@ public class MultiFormatTextBox : Control this.richTextBox!.Selection.Select(this.richTextBox.Selection.End, this.richTextBox.Selection.End); } } + + private Brush GetBackgroundBrushForFormat(FormatType format) + { + var formatObj = formats.Where(f => f.AssociatedFormatType == format).First(); + return formatObj.BackgroundBrush; + } } diff --git a/MultiTerm.Wpf/View/ShellView.xaml b/MultiTerm.Wpf/View/ShellView.xaml index 26632d8..913ce41 100644 --- a/MultiTerm.Wpf/View/ShellView.xaml +++ b/MultiTerm.Wpf/View/ShellView.xaml @@ -137,13 +137,15 @@ - - + + - + ScrollViewer.VerticalScrollBarVisibility="Auto" + ScrollViewer.CanContentScroll="True">