fixed bug with wrong colors in MultiFormatTextBox,

fixed scrolling in history list view
master
Jonas Arnold 3 years ago
parent 3539ecb0da
commit 034138f7de
  1. 9
      MultiTerm.Wpf.CustomControl/MultiFormatTextBox/MultiFormatTextBox.cs
  2. 14
      MultiTerm.Wpf/View/ShellView.xaml

@ -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;
}
}

@ -137,13 +137,15 @@
</Button>
<!-- Left Panel that holds History and Command Sets -->
<StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="0" Width="Auto">
<GroupBox Header="Send History">
<DockPanel Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" Width="Auto">
<GroupBox Header="Send History" DockPanel.Dock="Top">
<!-- History -->
<ListView x:Name="historyListView"
<ListView x:Name="historyListView" Height="{Binding Path=ActualHeight, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type StackPanel}}}"
ItemsSource="{Binding Path=SelectedTerminalViewModel.SentMessagesHistory}"
VerticalContentAlignment="Top"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto">
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.CanContentScroll="True">
<!-- Hide ListView if there are no items -->
<ListView.Style>
<Style TargetType="{x:Type ListView}">
@ -180,8 +182,8 @@
</ListView.ItemTemplate>
</ListView>
</GroupBox>
</StackPanel>
</DockPanel>
<!-- Splitter between two parts of UI -->
<GridSplitter Grid.Column="0" Grid.RowSpan="2" Width="2.5" Background="LightGray"/>

Loading…
Cancel
Save