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:
Claude committed 2026-10-03 17:22:42 +00:00
1 parent 6e01995f7e
commit 3f8464aabc
29 files changed
+711 -144

No files matched your search

+55 -1
View File
@@ -1,5 +1,8 @@
using System.Collections;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
@@ -12,7 +15,9 @@ namespace Titano.Ui.Visuals;
/// The main part executes <see cref="Command"/>; choosing a menu entry sets <see cref="SelectedItem"/> (checked in
/// the menu) — bind <see cref="CommandParameter"/> to it to act on the chosen preset. The control's ToolTip
/// describes the main action, <see cref="DropDownToolTip"/> the ▾ part. F4 or Alt+Down opens the menu.
/// <see cref="IsPrimary"/> gives the accent look of the screen's primary button.
/// <see cref="IsPrimary"/> gives the accent look of the screen's primary button. Screen readers see a split button
/// (named by AutomationProperties.Name or the content) that invokes and expands, holding the two parts;
/// <see cref="DropDownName"/> names the ▾ part.
/// </summary>
public class SplitButton : Control
{
@@ -25,6 +30,7 @@ public class SplitButton : Control
public static readonly DependencyProperty ItemContainerStyleProperty = DependencyProperty.Register(nameof(ItemContainerStyle), typeof(Style), typeof(SplitButton));
public static readonly DependencyProperty DisplayMemberPathProperty = DependencyProperty.Register(nameof(DisplayMemberPath), typeof(string), typeof(SplitButton));
public static readonly DependencyProperty DropDownToolTipProperty = DependencyProperty.Register(nameof(DropDownToolTip), typeof(object), typeof(SplitButton));
public static readonly DependencyProperty DropDownNameProperty = DependencyProperty.Register(nameof(DropDownName), typeof(string), typeof(SplitButton));
public static readonly DependencyProperty IsPrimaryProperty = DependencyProperty.Register(nameof(IsPrimary), typeof(bool), typeof(SplitButton));
public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register(
@@ -69,6 +75,9 @@ public class SplitButton : Control
/// <summary>Tooltip of the ▾ part.</summary>
public object? DropDownToolTip { get => GetValue(DropDownToolTipProperty); set => SetValue(DropDownToolTipProperty, value); }
/// <summary>Accessible name of the ▾ part (default "More choices").</summary>
public string? DropDownName { get => (string?)GetValue(DropDownNameProperty); set => SetValue(DropDownNameProperty, value); }
/// <summary>Accent fill (the one primary action of a screen).</summary>
public bool IsPrimary { get => (bool)GetValue(IsPrimaryProperty); set => SetValue(IsPrimaryProperty, value); }
@@ -84,11 +93,25 @@ public class SplitButton : Control
}
}
protected override AutomationPeer OnCreateAutomationPeer() => new SplitButtonAutomationPeer(this);
/// <summary>Runs the main action, as a click on the main part does.</summary>
internal void Invoke()
{
if (Command is { } command && command.CanExecute(CommandParameter)) command.Execute(CommandParameter);
}
private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var button = (SplitButton)d;
if ((bool)e.NewValue) button.EnsureMenu().IsOpen = true;
else if (button._menu is { IsOpen: true } menu) menu.IsOpen = false;
if (UIElementAutomationPeer.FromElement(button) is { } peer)
{
peer.RaisePropertyChangedEvent(ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty,
(bool)e.OldValue ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed,
(bool)e.NewValue ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed);
}
}
private ContextMenu EnsureMenu()
@@ -124,3 +147,34 @@ public class SplitButton : Control
container.IsChecked = Equals(_menu.Items[i], SelectedItem);
}
}
/// <summary>UI Automation view of a <see cref="SplitButton"/>: Invoke runs the main action, ExpandCollapse opens the choices.</summary>
public sealed class SplitButtonAutomationPeer(SplitButton owner) : FrameworkElementAutomationPeer(owner), IInvokeProvider, IExpandCollapseProvider
{
private SplitButton Button => (SplitButton)Owner;
public ExpandCollapseState ExpandCollapseState => Button.IsDropDownOpen ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed;
public override object? GetPattern(PatternInterface patternInterface) =>
patternInterface is PatternInterface.Invoke or PatternInterface.ExpandCollapse ? this : base.GetPattern(patternInterface);
public void Invoke()
{
if (!IsEnabled()) throw new ElementNotEnabledException();
Button.Invoke();
}
public void Expand() => Button.SetCurrentValue(SplitButton.IsDropDownOpenProperty, true);
public void Collapse() => Button.SetCurrentValue(SplitButton.IsDropDownOpenProperty, false);
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.SplitButton;
protected override string GetClassNameCore() => nameof(SplitButton);
protected override string GetNameCore()
{
var name = base.GetNameCore();
return string.IsNullOrEmpty(name) ? Button.Content as string ?? string.Empty : name;
}
}