fix(ui): toasts render; RTL-aware icons, charts and media; keyboard and screen-reader support in the kit
- ToastHost gets its template (nothing drew before); toasts are announced, pause while hovered or focused, Esc dismisses the focused one, the action closes it, FocusNewest brings the keyboard to them. - Windows take the UI language's direction when created and follow every switch. - Icons mirror only when the glyph is directional (IconData.IsDirectional, Bidi.IsDirectional override); the brand mark never mirrors; icons centre in stretched slots (ComboBox chevron). - Card photos, scrub position, preview surface and shot data, mono templates, paths are left-to-right islands; the preview tool row follows the layout direction. - Chart words (categories, legends, summaries) read in the UI direction and legends start on its side. - Automation peers: charts as named images, filmstrip as a slider, curve editor value, preview image, split button, AutoSlider group; localized names for caption, reset, remove, dismiss and drop-down buttons. - Focus visible on list and table rows and the preview; curve editor fully operable by keyboard. - Rail item collapsed layout fixed; job bar trims its text only once the bar is at its minimum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
29 files changed
+711
-144
No files matched your search
@@ -1,14 +1,17 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using Titano.Core.Localization;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Advisor-aware slider (BRIEF §10.4, DESIGN §4): in Auto the track is accent with an "Auto · value" pill whose
|
||||
/// tooltip carries the advisor's reason; touching the slider switches to manual (sun track, value shown, reset
|
||||
/// button returns to Auto). When not applicable the value reads "n/a" with the reason in the tooltip.
|
||||
/// button returns to Auto). When not applicable the value reads "n/a" with the reason in the tooltip. Screen readers
|
||||
/// see a group named after <see cref="Header"/> holding the named slider, the Auto pill and the reset button.
|
||||
/// </summary>
|
||||
[TemplatePart(Name = PartSlider, Type = typeof(Slider))]
|
||||
public class AutoSlider : Control
|
||||
@@ -47,6 +50,14 @@ public class AutoSlider : Control
|
||||
public AutoSlider()
|
||||
{
|
||||
CommandBindings.Add(new CommandBinding(ResetCommand, (_, _) => ResetToAuto()));
|
||||
// The pill and the value follow a language switch; the static event is held only while the slider is shown.
|
||||
Loaded += (_, _) =>
|
||||
{
|
||||
Loc.CultureChanged -= OnCultureChanged;
|
||||
Loc.CultureChanged += OnCultureChanged;
|
||||
UpdateTexts();
|
||||
};
|
||||
Unloaded += (_, _) => Loc.CultureChanged -= OnCultureChanged;
|
||||
UpdateTexts();
|
||||
}
|
||||
|
||||
@@ -67,7 +78,7 @@ public class AutoSlider : Control
|
||||
/// <summary>Formatted current value (read by the template).</summary>
|
||||
public string DisplayValue { get => (string)GetValue(DisplayValueProperty); private set => SetValue(DisplayValueProperty, value); }
|
||||
|
||||
/// <summary>"Auto · 41" pill text; the "Auto" word comes from the catalog (Common.Auto).</summary>
|
||||
/// <summary>"Auto · 41" pill text (Common.AutoValue).</summary>
|
||||
public string AutoText { get => (string)GetValue(AutoTextProperty); private set => SetValue(AutoTextProperty, value); }
|
||||
|
||||
/// <summary>Tooltip of the slider track: what moving it does.</summary>
|
||||
@@ -131,12 +142,30 @@ public class AutoSlider : Control
|
||||
s.UpdateTexts();
|
||||
}
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer() => new AutoSliderAutomationPeer(this);
|
||||
|
||||
private static void OnFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((AutoSlider)d).UpdateTexts();
|
||||
|
||||
private void OnCultureChanged(object? sender, EventArgs e) => UpdateTexts();
|
||||
|
||||
private void UpdateTexts()
|
||||
{
|
||||
var culture = Core.Localization.Loc.Culture;
|
||||
var culture = Loc.Culture;
|
||||
DisplayValue = Value.ToString(ValueFormat, culture);
|
||||
AutoText = Core.Localization.Loc.L("Common.Auto") + " · " + AutoValue.ToString(ValueFormat, culture);
|
||||
AutoText = Loc.L("Common.AutoValue", AutoValue.ToString(ValueFormat, culture));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A named group around the slider, the Auto pill and the reset button.</summary>
|
||||
public sealed class AutoSliderAutomationPeer(AutoSlider owner) : FrameworkElementAutomationPeer(owner)
|
||||
{
|
||||
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Group;
|
||||
|
||||
protected override string GetClassNameCore() => nameof(AutoSlider);
|
||||
|
||||
protected override string GetNameCore()
|
||||
{
|
||||
var name = base.GetNameCore();
|
||||
return string.IsNullOrEmpty(name) ? ((AutoSlider)Owner).Header ?? string.Empty : name;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user