Files
StarterNG/StarterNG/Infrastructure/StatsBar.cs
2026-08-30 22:29:45 +02:00

41 lines
1.2 KiB
C#

using System.Collections.Generic;
using Avalonia.Controls;
using Avalonia.Layout;
using Avalonia.Media;
namespace StarterNG.Infrastructure;
public static class StatsBar
{
public static void Fill(Panel host, IReadOnlyList<(string Label, string Value)> fields)
{
host.Children.Clear();
foreach (var (label, value) in fields)
{
var pair = new StackPanel
{
Orientation = Orientation.Horizontal,
Spacing = 5,
Margin = new Avalonia.Thickness(0, 0, 22, 0),
VerticalAlignment = VerticalAlignment.Center
};
pair.Children.Add(new TextBlock
{
Text = label,
FontSize = 12,
Opacity = 0.65,
VerticalAlignment = VerticalAlignment.Center
});
pair.Children.Add(new TextBlock
{
Text = value,
FontSize = 12,
FontWeight = FontWeight.SemiBold,
VerticalAlignment = VerticalAlignment.Center,
TextTrimming = TextTrimming.CharacterEllipsis
});
host.Children.Add(pair);
}
}
}