From dcc1eb00d3b52bf7b5bb61daf3018a70c59c4b81 Mon Sep 17 00:00:00 2001 From: Marco Russo Date: Thu, 27 Aug 2026 17:30:26 +0200 Subject: [PATCH 1/2] Reflow drawn setting choices instead of clipping them, and bump to 1.1.3 Toolbar / Position puts five drawn choices in one row. At the dialog's 560px minimum the content column is about 330px, so each segment holds roughly 52px inside its padding - less than the 44px "Bottom" needs once the border is taken out. A word too long for its line overflows and is clipped rather than wrapped, and TextTrimming does not help because it applies only when the height is constrained, so the label read as a different word: "Bottor right". The UniformGrid now recomputes its column count from its own width against the width at which a segment can hold that word. Five choices stay on one row at the default size and take a second row as the dialog narrows. Settings with two or three choices never reach the floor. The sample itself is wrapped in a down-only Viewbox, so it scales with the column rather than overflowing and losing its edges, and the segment template now honours HorizontalContentAlignment so the label is given the width it is being measured against. Co-Authored-By: Claude Opus 5 --- Directory.Build.props | 2 +- TODO.md | 2 +- .../PreferencesWindow.xaml.cs | 46 ++++++++++++++++--- src/SQLBI.Whiteboard/Themes/Settings.xaml | 6 +-- 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 3a08133..915cc5a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,7 +5,7 @@ scripts/build-installer.ps1 both read it from here, so releasing is a reviewed change to this line rather than an edit in a pipeline variable group. --> - 1.1.2 + 1.1.3 latest enable enable diff --git a/TODO.md b/TODO.md index 6dc7195..8c33bf3 100644 --- a/TODO.md +++ b/TODO.md @@ -16,7 +16,7 @@ The delivery chain works end to end: a merge to `main` builds, signs, and publis pre-release to GitHub Releases, and one approval promotes that same build to a release. reads its download links from the release manifest deployed beside it and needs no edit per release. The current product version is `VersionPrefix` in `Directory.Build.props` -(1.1.2). Identity version for the Store package is `VersionPrefix.0` (`1.1.2.0`). +(1.1.3). Identity version for the Store package is `VersionPrefix.0` (`1.1.3.0`). Declaring that number is decision 20 in [docs/decisions.md](docs/decisions.md). What 1.0 was waiting on shipped during 0.9.x: Preferences, `.wimport`, Explorer and VS Code diff --git a/src/SQLBI.Whiteboard/PreferencesWindow.xaml.cs b/src/SQLBI.Whiteboard/PreferencesWindow.xaml.cs index 079d2f7..fe80176 100644 --- a/src/SQLBI.Whiteboard/PreferencesWindow.xaml.cs +++ b/src/SQLBI.Whiteboard/PreferencesWindow.xaml.cs @@ -229,10 +229,25 @@ private FrameworkElement CreateSampleChoice( SettingDescriptor setting, Func sampleFor) { - var host = new UniformGrid - { - Rows = 1, - Columns = setting.Choices.Count, + // Below this a segment cannot hold the longest word in a label - "Bottom" + // is 44px at the 12px label size, and the padding and border take the + // rest - and a word too long for its line overflows and is clipped + // rather than wrapped or trimmed. So the row reflows instead: five + // choices sit in one row at the default width and take a second row + // when the dialog is dragged towards its minimum. + const double MinimumSegmentWidth = 82; + + var host = new UniformGrid { Columns = setting.Choices.Count }; + host.SizeChanged += (_, args) => + { + var columns = Math.Clamp( + (int)(args.NewSize.Width / MinimumSegmentWidth), + 1, + setting.Choices.Count); + if (host.Columns != columns) + { + host.Columns = columns; + } }; var segments = new List(); @@ -243,17 +258,33 @@ private FrameworkElement CreateSampleChoice( continue; } - var content = new StackPanel { HorizontalAlignment = HorizontalAlignment.Center }; + var content = new StackPanel { HorizontalAlignment = HorizontalAlignment.Stretch }; + + // The sample is drawn at a fixed size and then allowed to shrink + // with the column. Left to its own width it overflowed a narrowed + // dialog and was clipped, edges first, which is worse than small. sample.HorizontalAlignment = HorizontalAlignment.Center; - content.Children.Add(sample); + content.Children.Add(new Viewbox + { + Child = sample, + Stretch = Stretch.Uniform, + StretchDirection = StretchDirection.DownOnly, + MaxWidth = sample.Width > 0 ? sample.Width : double.PositiveInfinity, + HorizontalAlignment = HorizontalAlignment.Center, + }); + + // Wrapping runs out at the longest word, and a clipped word reads as + // a different one. Past that point the picture carries the meaning, + // and the tooltip still spells it out. content.Children.Add(new TextBlock { Style = (Style)FindResource("SettingsValueLabel"), Text = choice.Title, Margin = new Thickness(0, 8, 0, 0), TextWrapping = TextWrapping.Wrap, + TextTrimming = TextTrimming.CharacterEllipsis, TextAlignment = TextAlignment.Center, - HorizontalAlignment = HorizontalAlignment.Center, + HorizontalAlignment = HorizontalAlignment.Stretch, }); var segment = new ToggleButton @@ -263,6 +294,7 @@ private FrameworkElement CreateSampleChoice( IsChecked = choice.Id == CurrentEnumId(setting), Tag = choice.Id, ToolTip = choice.Title, + HorizontalContentAlignment = HorizontalAlignment.Stretch, }; segment.Click += (_, _) => { diff --git a/src/SQLBI.Whiteboard/Themes/Settings.xaml b/src/SQLBI.Whiteboard/Themes/Settings.xaml index f6921f0..7adf003 100644 --- a/src/SQLBI.Whiteboard/Themes/Settings.xaml +++ b/src/SQLBI.Whiteboard/Themes/Settings.xaml @@ -300,9 +300,9 @@