diff --git a/StarterNG/Views/Depot.axaml.cs b/StarterNG/Views/Depot.axaml.cs index 17fa29a..0a73015 100644 --- a/StarterNG/Views/Depot.axaml.cs +++ b/StarterNG/Views/Depot.axaml.cs @@ -192,7 +192,12 @@ public partial class Depot : UserControl } /// Redraws the consist cards, e.g. after the thumbnail size changed. - public void RefreshConsistView() => RebuildConsist(); + /// Redraws what depends on the thumbnail size: the consist and the class list. + public void RefreshConsistView() + { + _browser.InitClassComboTemplates(); + RebuildConsist(); + } private void RebuildConsist() { diff --git a/StarterNG/Views/Depot/VehicleBrowser.cs b/StarterNG/Views/Depot/VehicleBrowser.cs index 020b14d..da55b61 100644 --- a/StarterNG/Views/Depot/VehicleBrowser.cs +++ b/StarterNG/Views/Depot/VehicleBrowser.cs @@ -175,12 +175,18 @@ public sealed class VehicleBrowser Rebuild(); } + /// + /// The open list shows its thumbnails at the size the consist cards use, large or + /// small as set; the closed box keeps a compact line. Called again when that + /// setting changes, so the open list follows. + /// public void InitClassComboTemplates() { + int listHeight = VehicleCardStyle.ThumbHeight; classCombo.ItemTemplate = new FuncDataTemplate( - (cls, _) => ClassComboContent(cls, large: true), false); + (cls, _) => ClassComboContent(cls, listHeight, stacked: true), false); classCombo.SelectionBoxItemTemplate = new FuncDataTemplate( - (cls, _) => ClassComboContent(cls, large: false), false); + (cls, _) => ClassComboContent(cls, CompactThumbHeight, stacked: false), false); } private void FillClassCombo() @@ -220,14 +226,13 @@ public sealed class VehicleBrowser _db.Textures.FirstOrDefault(t => string.Equals(VehicleInfo.ClassOf(t), cls, StringComparison.OrdinalIgnoreCase)) is { } t ? VehicleInfo.CategoryOf(t) : null; - private Control ClassComboContent(string cls, bool large) + private Control ClassComboContent(string cls, int height, bool stacked) { - int height = large ? MiniPreviewHeight : CompactThumbHeight; var cell = new StackPanel { - Orientation = large ? Orientation.Vertical : Orientation.Horizontal, - Spacing = large ? 2 : 8, - HorizontalAlignment = large ? HorizontalAlignment.Center : HorizontalAlignment.Left, + Orientation = stacked ? Orientation.Vertical : Orientation.Horizontal, + Spacing = stacked ? 2 : 8, + HorizontalAlignment = stacked ? HorizontalAlignment.Center : HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center }; var bmp = _minis.Get(cls, height); @@ -242,7 +247,7 @@ public sealed class VehicleBrowser cell.Children.Add(new TextBlock { Text = cls, - HorizontalAlignment = large ? HorizontalAlignment.Center : HorizontalAlignment.Left, + HorizontalAlignment = stacked ? HorizontalAlignment.Center : HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center, TextAlignment = TextAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis