mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-19 15:02:15 +01:00
fix: NVDA hears a tree entry open, a list's new choice and the pictures and figures
Under the mouse a reader hears only what lies there. The row of a tree entry now carries whether it is open, an arrow or icon in it its name; a picture takes the name of the button or card it sits in, the scenery picture says what it shows; a consist figure is one text, label and value together. Avalonia tells Windows of a closed list's new value only for a list one types into, so going through the weathers with the arrows was silent; the new choice is now said aloud.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Documents;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Markup.Xaml.MarkupExtensions;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace StarterNG.Infrastructure;
|
||||
@@ -13,31 +15,34 @@ public static class StatsBar
|
||||
for (int i = 0; i < fields.Count; i++)
|
||||
{
|
||||
var (label, value) = fields[i];
|
||||
var pair = new StackPanel
|
||||
{
|
||||
Orientation = Orientation.Horizontal,
|
||||
Spacing = 5,
|
||||
// no trailing gap on the last pair - these sit in a panel title,
|
||||
// flush with its right edge
|
||||
Margin = new Avalonia.Thickness(0, 0, i == fields.Count - 1 ? 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);
|
||||
host.Children.Add(Figure(label, value, last: i == fields.Count - 1));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One text holding the label and the value: under the mouse a reader hears the
|
||||
/// text that lies there, and with two it heard "Masa [t]:" without the mass.
|
||||
/// </summary>
|
||||
public static TextBlock Figure(string label, string value, bool last)
|
||||
{
|
||||
var name = new Run(label);
|
||||
// The label dimmed, as the panel titles' other labels.
|
||||
name.Bind(TextElement.ForegroundProperty, new DynamicResourceExtension("CarbonFgDim"));
|
||||
|
||||
return new TextBlock
|
||||
{
|
||||
FontSize = 12,
|
||||
// no trailing gap on the last pair - these sit in a panel title,
|
||||
// flush with its right edge
|
||||
Margin = new Avalonia.Thickness(0, 0, last ? 0 : 22, 0),
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
TextTrimming = TextTrimming.CharacterEllipsis,
|
||||
Inlines =
|
||||
{
|
||||
name,
|
||||
new Run(" "),
|
||||
new Run(value) { FontWeight = FontWeight.SemiBold },
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user