mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:automation="using:CalculatorApp.ViewModel.Common.Automation"
|
xmlns:automation="using:CalculatorApp.ViewModel.Common.Automation"
|
||||||
xmlns:converters="using:CalculatorApp.Converters"
|
xmlns:converters="using:CalculatorApp.Converters"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="using:CalculatorApp"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:model="using:CalculatorApp.ViewModel"
|
xmlns:model="using:CalculatorApp.ViewModel"
|
||||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||||
|
@ -56,14 +57,14 @@
|
||||||
</MenuFlyout>
|
</MenuFlyout>
|
||||||
|
|
||||||
<DataTemplate x:Key="HistoryItemTemplate" x:DataType="model:HistoryItemViewModel">
|
<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">
|
<StackPanel Margin="0,6,16,6" Background="Transparent">
|
||||||
<TextBlock x:Name="ExprTextBlock"
|
<TextBlock x:Name="ExprTextBlock"
|
||||||
Margin="0,0,0,4"
|
Margin="0,0,0,4"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Style="{ThemeResource BodyTextBlockMediumStyle}"
|
Style="{ThemeResource BodyTextBlockMediumStyle}"
|
||||||
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
AutomationProperties.AutomationId="HistoryItemExpression"
|
AutomationProperties.AutomationId="HistoryItemExpression"
|
||||||
AutomationProperties.Name="{x:Bind AccExpression}"
|
|
||||||
IsTextSelectionEnabled="True"
|
IsTextSelectionEnabled="True"
|
||||||
Text="{x:Bind Expression}"
|
Text="{x:Bind Expression}"
|
||||||
TextAlignment="Right"
|
TextAlignment="Right"
|
||||||
|
@ -71,8 +72,8 @@
|
||||||
<TextBlock x:Name="ResultTextBlock"
|
<TextBlock x:Name="ResultTextBlock"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Style="{ThemeResource SubtitleTextBlockStyle}"
|
Style="{ThemeResource SubtitleTextBlockStyle}"
|
||||||
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
AutomationProperties.AutomationId="HistoryItemValue"
|
AutomationProperties.AutomationId="HistoryItemValue"
|
||||||
AutomationProperties.Name="{x:Bind AccResult}"
|
|
||||||
IsTextSelectionEnabled="True"
|
IsTextSelectionEnabled="True"
|
||||||
Text="{x:Bind Result}"
|
Text="{x:Bind Result}"
|
||||||
TextAlignment="Right"
|
TextAlignment="Right"
|
||||||
|
|
|
@ -43,6 +43,11 @@ namespace CalculatorApp
|
||||||
public static readonly DependencyProperty RowHeightProperty =
|
public static readonly DependencyProperty RowHeightProperty =
|
||||||
DependencyProperty.Register(nameof(RowHeight), typeof(Windows.UI.Xaml.GridLength), typeof(HistoryList), new PropertyMetadata(default(Windows.UI.Xaml.GridLength)));
|
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)
|
private void ListView_ItemClick(object sender, ItemClickEventArgs e)
|
||||||
{
|
{
|
||||||
HistoryViewModel historyVM = (DataContext as HistoryViewModel);
|
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="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:common="using:CalculatorApp.Common"
|
xmlns:common="using:CalculatorApp.Common"
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
</MenuFlyout>
|
</MenuFlyout>
|
||||||
|
|
||||||
<DataTemplate x:Key="MemoryItemTemplate" x:DataType="model:MemoryItemViewModel">
|
<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>
|
</DataTemplate>
|
||||||
<Style x:Key="MemoryItemContainerStyle"
|
<Style x:Key="MemoryItemContainerStyle"
|
||||||
BasedOn="{StaticResource HistoryMemoryItemContainerStyle}"
|
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="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
@ -52,6 +52,7 @@
|
||||||
<TextBlock Margin="0,4,20,0"
|
<TextBlock Margin="0,4,20,0"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Style="{ThemeResource SubtitleTextBlockStyle}"
|
Style="{ThemeResource SubtitleTextBlockStyle}"
|
||||||
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
AutomationProperties.AutomationId="MemoryItemValue"
|
AutomationProperties.AutomationId="MemoryItemValue"
|
||||||
FlowDirection="LeftToRight"
|
FlowDirection="LeftToRight"
|
||||||
IsTextSelectionEnabled="True"
|
IsTextSelectionEnabled="True"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue