mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
add automation name for history and memory list item
This commit is contained in:
parent
e06355c9aa
commit
99ab9d87f0
4 changed files with 14 additions and 7 deletions
|
@ -1,9 +1,10 @@
|
|||
<UserControl x:Class="CalculatorApp.HistoryList"
|
||||
<UserControl x:Class="CalculatorApp.HistoryList"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:automation="using:CalculatorApp.ViewModel.Common.Automation"
|
||||
xmlns:converters="using:CalculatorApp.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:CalculatorApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:model="using:CalculatorApp.ViewModel"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
|
@ -56,14 +57,14 @@
|
|||
</MenuFlyout>
|
||||
|
||||
<DataTemplate x:Key="HistoryItemTemplate" x:DataType="model:HistoryItemViewModel">
|
||||
<muxc:SwipeControl RightItems="{StaticResource HistorySwipeItems}">
|
||||
<muxc:SwipeControl AutomationProperties.Name="{x:Bind local:HistoryList.GetHistoryItemAutomationName(AccExpression, AccResult)}" RightItems="{StaticResource HistorySwipeItems}">
|
||||
<StackPanel Margin="0,6,16,6" Background="Transparent">
|
||||
<TextBlock x:Name="ExprTextBlock"
|
||||
Margin="0,0,0,4"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{ThemeResource BodyTextBlockMediumStyle}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
AutomationProperties.AutomationId="HistoryItemExpression"
|
||||
AutomationProperties.Name="{x:Bind AccExpression}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="{x:Bind Expression}"
|
||||
TextAlignment="Right"
|
||||
|
@ -71,8 +72,8 @@
|
|||
<TextBlock x:Name="ResultTextBlock"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{ThemeResource SubtitleTextBlockStyle}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
AutomationProperties.AutomationId="HistoryItemValue"
|
||||
AutomationProperties.Name="{x:Bind AccResult}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="{x:Bind Result}"
|
||||
TextAlignment="Right"
|
||||
|
|
|
@ -43,6 +43,11 @@ namespace CalculatorApp
|
|||
public static readonly DependencyProperty RowHeightProperty =
|
||||
DependencyProperty.Register(nameof(RowHeight), typeof(Windows.UI.Xaml.GridLength), typeof(HistoryList), new PropertyMetadata(default(Windows.UI.Xaml.GridLength)));
|
||||
|
||||
public static string GetHistoryItemAutomationName(string accExpression, string accResult)
|
||||
{
|
||||
return $"{accExpression} {accResult}";
|
||||
}
|
||||
|
||||
private void ListView_ItemClick(object sender, ItemClickEventArgs e)
|
||||
{
|
||||
HistoryViewModel historyVM = (DataContext as HistoryViewModel);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<UserControl x:Class="CalculatorApp.Memory"
|
||||
<UserControl x:Class="CalculatorApp.Memory"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:common="using:CalculatorApp.Common"
|
||||
|
@ -36,7 +36,7 @@
|
|||
</MenuFlyout>
|
||||
|
||||
<DataTemplate x:Key="MemoryItemTemplate" x:DataType="model:MemoryItemViewModel">
|
||||
<local:MemoryListItem Model="{x:Bind Mode=OneWay}"/>
|
||||
<local:MemoryListItem AutomationProperties.Name="{x:Bind Value, Mode=OneWay}" Model="{x:Bind Mode=OneWay}"/>
|
||||
</DataTemplate>
|
||||
<Style x:Key="MemoryItemContainerStyle"
|
||||
BasedOn="{StaticResource HistoryMemoryItemContainerStyle}"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<UserControl x:Class="CalculatorApp.MemoryListItem"
|
||||
<UserControl x:Class="CalculatorApp.MemoryListItem"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
@ -52,6 +52,7 @@
|
|||
<TextBlock Margin="0,4,20,0"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{ThemeResource SubtitleTextBlockStyle}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
AutomationProperties.AutomationId="MemoryItemValue"
|
||||
FlowDirection="LeftToRight"
|
||||
IsTextSelectionEnabled="True"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue