Fit more of the log on screen and edit a cell without fighting it
The theme gave each cell 32 pixels of height, which fits about seven contacts in the window. A row is now as tall as its text and one pixel either side, so about fifteen fit. Editing a cell: - the columns bind one way, and the value is written back when the edit is taken, on Enter or a click elsewhere. A two-way binding wrote on every key press, which took the edit as the first character was typed and closed the box. - Enter on the current cell opens the box. The handler runs before the grid's own, which reads Enter as "move down a line". - Left, Right, Home and End stay in the box. The grid read a key the box left alone as "go to the next cell", and the box leaves a key alone when the caret cannot move; End also landed at the start of the text. - the box takes the height and the left inset of the text it covers, so nothing moves as it opens. An edit no longer rebuilds the list. The lines on screen are given the contact again, so the view stays where the operator put it instead of jumping to the top and back. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0157i7PiZyqBkquxS9A6FTdQ
This commit is contained in:
@@ -149,9 +149,11 @@ public sealed partial class LogWindow
|
||||
? new DataGridLength(1, DataGridLengthUnitType.Star)
|
||||
: new DataGridLength(Width(column)),
|
||||
MinWidth = Width(column),
|
||||
Binding = column.IsEditable
|
||||
? new Binding($"[{column.Field}]") { Mode = BindingMode.TwoWay }
|
||||
: new Binding($"[{column.Field}]"),
|
||||
// one way in both directions of the grid: `LogWindow.TakeCellEdit`
|
||||
// writes an edited cell back. A two-way binding would write on
|
||||
// every key press, and the DataGrid turns a binding without a
|
||||
// mode into a two-way one
|
||||
Binding = new Binding($"[{column.Field}]") { Mode = BindingMode.OneWay },
|
||||
CustomSortComparer = By(column.Field),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user