The summary table labels had no foreground set, so only the highlighted numbers drew. The window now has the two-line Mults/Qs and Bands/Modes buttons, a bold summary table, a list sorted on frequency, a ringed picked row, a tick in the Mlt column and N1MM's empty-list message. Bands & Modes opens a window with band groups and the CW, Phone, Digital and Contest modes. The hover text uses SpotDescription like the bandmap, so control characters and the cluster time are gone. Grid columns keep a minimum width of their heading in the Available, Statistics and Network status windows. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System.Globalization;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Media;
|
|
|
|
namespace Nonemm.App.Windows;
|
|
|
|
/// Stops a grid column being dragged, or sized to its cells, narrower than its
|
|
/// own heading.
|
|
public static class ColumnWidths
|
|
{
|
|
/// What a header takes besides its text: its padding and the room the theme
|
|
/// keeps for the sort arrow.
|
|
private const double HeaderPadding = 40;
|
|
|
|
/// The width of the heading in the grid's font, with the room the arrow
|
|
/// needs.
|
|
public static double ForHeader(DataGrid grid, string heading) =>
|
|
new FormattedText(
|
|
heading,
|
|
CultureInfo.InvariantCulture,
|
|
FlowDirection.LeftToRight,
|
|
new Typeface(grid.FontFamily, FontStyle.Normal, FontWeight.Bold),
|
|
grid.FontSize,
|
|
null).Width + HeaderPadding;
|
|
|
|
public static void KeepHeadersReadable(DataGrid grid)
|
|
{
|
|
foreach (DataGridColumn column in grid.Columns)
|
|
{
|
|
if (column.Header is string heading)
|
|
{
|
|
column.MinWidth = ForHeader(grid, heading);
|
|
}
|
|
}
|
|
}
|
|
}
|