mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
ImageResizer: fix hyperlink buttons role
This commit is contained in:
committed by
Andrey Nekrasov
parent
ebf81a6a03
commit
fbd1108041
24
src/modules/imageresizer/ui/Views/AccessibleHyperlink.cs
Normal file
24
src/modules/imageresizer/ui/Views/AccessibleHyperlink.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Automation.Peers;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
|
||||||
|
namespace ImageResizer.Views
|
||||||
|
{
|
||||||
|
public class AccessibleHyperlink : Hyperlink
|
||||||
|
{
|
||||||
|
public AutomationControlType ControlType { get; set; }
|
||||||
|
|
||||||
|
protected override AutomationPeer OnCreateAutomationPeer()
|
||||||
|
{
|
||||||
|
var peer = new CustomizableHyperlinkAutomationPeer(this);
|
||||||
|
|
||||||
|
peer.ControlType = ControlType;
|
||||||
|
return peer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -114,18 +114,18 @@
|
|||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<TextBlock Grid.Column="6" Margin="5,0,0,0" VerticalAlignment="Center">
|
<TextBlock Grid.Column="6" Margin="5,0,0,0" VerticalAlignment="Center">
|
||||||
<Hyperlink Command="{Binding DataContext.RemoveSizeCommand,ElementName=_this}" CommandParameter="{Binding}">
|
<local:AccessibleHyperlink ControlType="Button" Command="{Binding DataContext.RemoveSizeCommand,ElementName=_this}" CommandParameter="{Binding}">
|
||||||
<Run Text="{x:Static p:Resources.Advanced_DeleteSize}"/>
|
<Run Text="{x:Static p:Resources.Advanced_DeleteSize}"/>
|
||||||
</Hyperlink>
|
</local:AccessibleHyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
<TextBlock>
|
<TextBlock>
|
||||||
<Hyperlink Command="{Binding AddSizeCommand}">
|
<local:AccessibleHyperlink ControlType="Button" Command="{Binding AddSizeCommand}">
|
||||||
<Run Text="{x:Static p:Resources.Advanced_CreateSize}"/>
|
<Run Text="{x:Static p:Resources.Advanced_CreateSize}"/>
|
||||||
</Hyperlink>
|
</local:AccessibleHyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// 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.Windows.Automation.Peers;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
|
||||||
|
namespace ImageResizer.Views
|
||||||
|
{
|
||||||
|
public class CustomizableHyperlinkAutomationPeer : HyperlinkAutomationPeer
|
||||||
|
{
|
||||||
|
public CustomizableHyperlinkAutomationPeer(Hyperlink owner)
|
||||||
|
: base(owner)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public AutomationControlType ControlType { get; set; }
|
||||||
|
|
||||||
|
protected override AutomationControlType GetAutomationControlTypeCore()
|
||||||
|
{
|
||||||
|
return ControlType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -133,9 +133,9 @@
|
|||||||
|
|
||||||
<TextBlock VerticalAlignment="Center"
|
<TextBlock VerticalAlignment="Center"
|
||||||
Visibility="{Binding ShowAdvancedSettings, Converter={StaticResource BoolValueConverter}}">
|
Visibility="{Binding ShowAdvancedSettings, Converter={StaticResource BoolValueConverter}}">
|
||||||
<Hyperlink Command="{Binding ShowAdvancedCommand}">
|
<local:AccessibleHyperlink ControlType="Button" Command="{Binding ShowAdvancedCommand}">
|
||||||
<Run Text="{x:Static p:Resources.Input_ShowAdvanced}"/>
|
<Run Text="{x:Static p:Resources.Input_ShowAdvanced}"/>
|
||||||
</Hyperlink>
|
</local:AccessibleHyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
<Button Grid.Column="1"
|
<Button Grid.Column="1"
|
||||||
|
|||||||
Reference in New Issue
Block a user