[Fancy Zones] Fixed accessibility text of monitors on Layout Editor

This commit is contained in:
Ani 2025-01-21 23:16:26 +01:00
Родитель 438d17302e
Коммит f91c20ce4d
5 изменённых файлов: 50 добавлений и 8 удалений

Просмотреть файл

@ -83,9 +83,7 @@
<Border
x:Name="MonitorItem"
Width="{Binding DisplayWidth}"
Height="{Binding DisplayHeight}"
AutomationProperties.HelpText="{Binding Index}"
AutomationProperties.Name="{x:Static props:Resources.Monitor}">
Height="{Binding DisplayHeight}">
<Border.ToolTip>
<ToolTip>
<StackPanel>

Просмотреть файл

@ -5,7 +5,9 @@
using System;
using System.ComponentModel;
using System.Globalization;
using System.Text;
using FancyZonesEditor.Properties;
using FancyZonesEditor.ViewModels;
namespace FancyZonesEditor.Utils
@ -14,6 +16,8 @@ namespace FancyZonesEditor.Utils
{
public event PropertyChangedEventHandler PropertyChanged;
private static readonly CompositeFormat MonitorIndexFormat = CompositeFormat.Parse(Resources.Monitor_Index);
public MonitorInfoModel(int index, int height, int width, int dpi, bool selected = false)
{
Index = index;
@ -24,6 +28,10 @@ namespace FancyZonesEditor.Utils
Selected = selected;
}
public string AccessibleName => string.Format(CultureInfo.CurrentCulture, MonitorIndexFormat, Index);
public string AccessibleHelpText => $"{Resources.Dimensions} {Dimensions}, {Resources.Scaling} {Scaling}";
public int Index { get; set; }
public int ScreenBoundsHeight { get; set; }

Просмотреть файл

@ -276,6 +276,15 @@ namespace FancyZonesEditor.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Dimensions.
/// </summary>
public static string Dimensions {
get {
return ResourceManager.GetString("Dimensions", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Highlight distance.
/// </summary>
@ -539,7 +548,7 @@ namespace FancyZonesEditor.Properties {
/// <summary>
/// Looks up a localized string similar to
///• [Shift]+S to split currently focused zone.
///• Shift+S to split currently focused zone.
///• Ctrl+Tab to focus zones/resizers.
///• Tab to cycle zones and resizers.
///• Delete to remove the focused resizer.
@ -554,8 +563,8 @@ namespace FancyZonesEditor.Properties {
/// <summary>
/// Looks up a localized string similar to
///• Ctrl+Tab to switch focus between dialog and zones.
///• [Shift]+Arrows to resize the focused zone by 10px (5px per edge).
///• Ctrl+[Shift]+Arrows to resize the focused zone by 2px (1px per edge).
///• Shift+Arrows to resize the focused zone by 10px (5px per edge).
///• Ctrl+Shift+Arrows to resize the focused zone by 2px (1px per edge).
///• Arrows to move the focused zone by 10px.
///• Ctrl+Arrows to move the focused zone by 1px..
/// </summary>
@ -655,6 +664,15 @@ namespace FancyZonesEditor.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Monitor {0}.
/// </summary>
public static string Monitor_Index {
get {
return ResourceManager.GetString("Monitor_Index", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Name.
/// </summary>
@ -790,6 +808,15 @@ namespace FancyZonesEditor.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Scaling.
/// </summary>
public static string Scaling {
get {
return ResourceManager.GetString("Scaling", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Set layout as a default for horizontal monitor orientation.
/// </summary>

Просмотреть файл

@ -282,6 +282,15 @@
<data name="Monitor" xml:space="preserve">
<value>Monitor</value>
</data>
<data name="Monitor_Index" xml:space="preserve">
<value>Monitor {0}</value>
</data>
<data name="Dimensions" xml:space="preserve">
<value>Dimensions</value>
</data>
<data name="Scaling" xml:space="preserve">
<value>Scaling</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Template settings</value>
</data>

Просмотреть файл

@ -26,11 +26,11 @@
<Style x:Key="MonitorItemContainerStyle" TargetType="ui:GridViewItem">
<Setter Property="Background" Value="{DynamicResource LayoutItemBackgroundBrush}" />
<Setter Property="IsSelected" Value="{Binding Selected, Mode=OneWay}" />
<Setter Property="AutomationProperties.Name" Value="{Binding Index}" />
<Setter Property="AutomationProperties.Name" Value="{Binding AccessibleName}" />
<Setter Property="AutomationProperties.HelpText" Value="{Binding AccessibleHelpText}" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="Local" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="0" />
<!--<Setter Property="IsHoldingEnabled" Value="True" />-->
<Setter Property="CornerRadius" Value="4" />
<Setter Property="Margin" Value="8" />
<Setter Property="UseSystemFocusVisuals" Value="{DynamicResource UseSystemFocusVisuals}" />