[ImageResizer]Make narrator announce sizes ComboBox and CheckBoxes (#32311)

This commit is contained in:
Davide Giacometti
2024-04-16 12:33:00 +02:00
committed by GitHub
parent 8a210865ff
commit daae8f22de
5 changed files with 54 additions and 5 deletions

View File

@@ -19,6 +19,7 @@
<v:BoolValueConverter x:Key="BoolValueConverter" />
<v:VisibilityBoolConverter x:Key="VisibilityBoolConverter" />
<v:EnumToIntConverter x:Key="EnumToIntConverter" />
<v:AccessTextToTextConverter x:Key="AccessTextToTextConverter" />
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -87,6 +87,15 @@ namespace ImageResizer.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Image sizes.
/// </summary>
public static string Image_Sizes {
get {
return ResourceManager.GetString("Image_Sizes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Image Resizer.
/// </summary>
@@ -151,7 +160,7 @@ namespace ImageResizer.Properties {
}
/// <summary>
/// Looks up a localized string similar to Over_write files.
/// Looks up a localized string similar to Ov_erwrite files.
/// </summary>
public static string Input_Replace {
get {
@@ -177,6 +186,15 @@ namespace ImageResizer.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to _Make pictures smaller but not larger.
/// </summary>
public static string Input_ShrinkOnly_Content {
get {
return ResourceManager.GetString("Input_ShrinkOnly.Content", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Large.
/// </summary>

View File

@@ -290,4 +290,10 @@
<data name="Input_RemoveMetadata" xml:space="preserve">
<value>Remove meta_data that doesn't affect rendering</value>
</data>
<data name="Image_Sizes" xml:space="preserve">
<value>Image sizes</value>
</data>
<data name="Input_ShrinkOnly.Content" xml:space="preserve">
<value>_Make pictures smaller but not larger</value>
</data>
</root>

View File

@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Globalization;
using System.Windows.Data;
namespace ImageResizer.Views
{
public class AccessTextToTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return ((string)value).Replace("_", string.Empty);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -22,6 +22,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
VerticalContentAlignment="Stretch"
AutomationProperties.Name="{x:Static p:Resources.Image_Sizes}"
ItemsSource="{Binding Settings.AllSizes}"
SelectedIndex="{Binding Settings.SelectedSizeIndex}">
<ComboBox.Resources>
@@ -197,25 +198,25 @@
Grid.Row="1"
Margin="16"
Orientation="Vertical">
<CheckBox IsChecked="{Binding Settings.ShrinkOnly}">
<CheckBox AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self}, Path=Content.(AccessText.Text), Converter={StaticResource AccessTextToTextConverter}}" IsChecked="{Binding Settings.ShrinkOnly}">
<CheckBox.Content>
<AccessText Text="{x:Static p:Resources.Input_ShrinkOnly}" TextWrapping="Wrap" />
</CheckBox.Content>
</CheckBox>
<CheckBox IsChecked="{Binding Settings.IgnoreOrientation}">
<CheckBox AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self}, Path=Content.(AccessText.Text), Converter={StaticResource AccessTextToTextConverter}}" IsChecked="{Binding Settings.IgnoreOrientation}">
<CheckBox.Content>
<AccessText Text="{x:Static p:Resources.Input_IgnoreOrientation}" TextWrapping="Wrap" />
</CheckBox.Content>
</CheckBox>
<CheckBox IsChecked="{Binding Settings.Replace}">
<CheckBox AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self}, Path=Content.(AccessText.Text), Converter={StaticResource AccessTextToTextConverter}}" IsChecked="{Binding Settings.Replace}">
<CheckBox.Content>
<AccessText Text="{x:Static p:Resources.Input_Replace}" TextWrapping="Wrap" />
</CheckBox.Content>
</CheckBox>
<CheckBox IsChecked="{Binding Settings.RemoveMetadata}">
<CheckBox AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self}, Path=Content.(AccessText.Text), Converter={StaticResource AccessTextToTextConverter}}" IsChecked="{Binding Settings.RemoveMetadata}">
<CheckBox.Content>
<AccessText Text="{x:Static p:Resources.Input_RemoveMetadata}" TextWrapping="Wrap" />
</CheckBox.Content>