accessibility for audio and language controls
This commit is contained in:
parent
c783578bdf
commit
a7b6f9cb87
8 changed files with 76 additions and 27 deletions
|
@ -5,7 +5,7 @@
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:fa="http://schemas.fontawesome.io/icons/"
|
xmlns:fa="http://schemas.fontawesome.io/icons/"
|
||||||
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Desktop.Controls"
|
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Desktop.Controls"
|
||||||
mc:Ignorable="d" d:DesignHeight="40" d:DesignWidth="250">
|
mc:Ignorable="d" d:DesignHeight="40" d:DesignWidth="250" IsTabStop="True">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid x:Name="Grid" Background="{StaticResource ActionCenterDarkBrush}" Height="64" Margin="2">
|
<Grid x:Name="Grid" Background="{StaticResource ActionCenterDarkBrush}" Height="64" Margin="2">
|
||||||
<Popup x:Name="Popup" IsOpen="False" Placement="Top" PlacementTarget="{Binding ElementName=Button}">
|
<Popup x:Name="Popup" IsOpen="False" Placement="Top" PlacementTarget="{Binding ElementName=Button}" KeyUp="Popup_KeyUp">
|
||||||
<Border Background="Gray">
|
<Border Background="Gray">
|
||||||
<ScrollViewer MaxHeight="250" VerticalScrollBarVisibility="Auto" Template="{StaticResource SmallBarScrollViewer}">
|
<ScrollViewer MaxHeight="250" VerticalScrollBarVisibility="Auto" Template="{StaticResource SmallBarScrollViewer}">
|
||||||
<StackPanel x:Name="LayoutsStackPanel" />
|
<StackPanel x:Name="LayoutsStackPanel" />
|
||||||
|
|
|
@ -41,7 +41,14 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
|
||||||
InitializeLayouts();
|
InitializeLayouts();
|
||||||
|
|
||||||
keyboard.LayoutChanged += Keyboard_LayoutChanged;
|
keyboard.LayoutChanged += Keyboard_LayoutChanged;
|
||||||
Button.Click += (o, args) => Popup.IsOpen = !Popup.IsOpen;
|
Button.Click += (o, args) =>
|
||||||
|
{
|
||||||
|
Popup.IsOpen = !Popup.IsOpen;
|
||||||
|
this.Dispatcher.BeginInvoke((System.Action)(() =>
|
||||||
|
{
|
||||||
|
LayoutsStackPanel.Children[0].Focus();
|
||||||
|
}));
|
||||||
|
};
|
||||||
Button.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => Popup.IsOpen = Popup.IsMouseOver));
|
Button.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => Popup.IsOpen = Popup.IsMouseOver));
|
||||||
Popup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => Popup.IsOpen = IsMouseOver));
|
Popup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => Popup.IsOpen = IsMouseOver));
|
||||||
Popup.Opened += (o, args) => Grid.Background = Brushes.Gray;
|
Popup.Opened += (o, args) => Grid.Background = Brushes.Gray;
|
||||||
|
@ -90,5 +97,14 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
|
||||||
Text.Text = layout.CultureName;
|
Text.Text = layout.CultureName;
|
||||||
Button.ToolTip = tooltip;
|
Button.ToolTip = tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Popup_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == System.Windows.Input.Key.Enter || e.Key == System.Windows.Input.Key.Escape)
|
||||||
|
{
|
||||||
|
Popup.IsOpen = false;
|
||||||
|
Button.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Popup x:Name="Popup" IsOpen="False" Placement="Custom" PlacementTarget="{Binding ElementName=Button}">
|
<Popup x:Name="Popup" IsOpen="False" Placement="Custom" PlacementTarget="{Binding ElementName=Button}" KeyDown="Popup_KeyDown">
|
||||||
<Border Background="LightGray" BorderBrush="Gray" BorderThickness="1,1,1,0">
|
<Border Background="LightGray" BorderBrush="Gray" BorderThickness="1,1,1,0">
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<TextBlock x:Name="AudioDeviceName" Margin="5" TextAlignment="Center" />
|
<TextBlock x:Name="AudioDeviceName" Margin="5" TextAlignment="Center" />
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
<Button x:Name="MuteButton" Background="Transparent" Padding="5" Template="{StaticResource TaskbarButton}" Width="40">
|
<Button x:Name="MuteButton" Background="Transparent" Padding="5" Template="{StaticResource TaskbarButton}" Width="40">
|
||||||
<ContentControl x:Name="PopupIcon" />
|
<ContentControl x:Name="PopupIcon" />
|
||||||
</Button>
|
</Button>
|
||||||
<Slider x:Name="Volume" Grid.Column="1" Orientation="Horizontal" TickFrequency="1" Maximum="100" IsSnapToTickEnabled="True"
|
<Slider x:Name="Volume" Grid.Column="1" Orientation="Horizontal" TickFrequency="1" Maximum="100" IsSnapToTickEnabled="True" KeyDown="Volume_KeyDown"
|
||||||
IsMoveToPointEnabled="True" VerticalAlignment="Center" Width="250" Thumb.DragStarted="Volume_DragStarted" Thumb.DragCompleted="Volume_DragCompleted" />
|
IsMoveToPointEnabled="True" VerticalAlignment="Center" Width="250" Thumb.DragStarted="Volume_DragStarted" Thumb.DragCompleted="Volume_DragCompleted" />
|
||||||
<TextBlock Grid.Column="2" FontWeight="DemiBold" FontSize="16" Text="{Binding ElementName=Volume, Path=Value}"
|
<TextBlock Grid.Column="2" FontWeight="DemiBold" FontSize="16" Text="{Binding ElementName=Volume, Path=Value}"
|
||||||
TextAlignment="Center" VerticalAlignment="Center" Width="40" />
|
TextAlignment="Center" VerticalAlignment="Center" Width="40" />
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
</Border>
|
</Border>
|
||||||
</Popup>
|
</Popup>
|
||||||
<Button x:Name="Button" Background="Transparent" Padding="5" Template="{StaticResource TaskbarButton}" ToolTipService.ShowOnDisabled="True" Width="40">
|
<Button x:Name="Button" Background="Transparent" Padding="5" Template="{StaticResource TaskbarButton}" ToolTipService.ShowOnDisabled="True" Width="40">
|
||||||
<ContentControl x:Name="ButtonIcon" />
|
<ContentControl x:Name="ButtonIcon" Focusable="False" />
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
@ -60,6 +60,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
|
||||||
{
|
{
|
||||||
Background = Brushes.LightGray;
|
Background = Brushes.LightGray;
|
||||||
Button.Background = Brushes.LightGray;
|
Button.Background = Brushes.LightGray;
|
||||||
|
Volume.Focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
Popup.Closed += (o, args) =>
|
Popup.Closed += (o, args) =>
|
||||||
|
@ -167,5 +168,23 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
|
||||||
|
|
||||||
return IconResourceLoader.Load(resource);
|
return IconResourceLoader.Load(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Popup_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == System.Windows.Input.Key.Escape)
|
||||||
|
{
|
||||||
|
Popup.IsOpen = false;
|
||||||
|
Button.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Volume_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == System.Windows.Input.Key.Enter)
|
||||||
|
{
|
||||||
|
Popup.IsOpen = false;
|
||||||
|
Button.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid>
|
|
||||||
<Button x:Name="Button" Background="Transparent" Height="40" Padding="10,0" Template="{StaticResource TaskbarButton}">
|
<Button x:Name="Button" Background="Transparent" Height="40" Padding="10,0" Template="{StaticResource TaskbarButton}">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
@ -33,5 +32,4 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Popup x:Name="Popup" IsOpen="False" Placement="Custom" PlacementTarget="{Binding ElementName=Button}">
|
<Popup x:Name="Popup" IsOpen="False" Placement="Custom" PlacementTarget="{Binding ElementName=Button}" KeyUp="Popup_KeyUp">
|
||||||
<Border Background="LightGray" BorderBrush="Gray" BorderThickness="1,1,1,0">
|
<Border Background="LightGray" BorderBrush="Gray" BorderThickness="1,1,1,0">
|
||||||
<ScrollViewer x:Name="LayoutsScrollViewer" MaxHeight="250" VerticalScrollBarVisibility="Auto" Template="{StaticResource SmallBarScrollViewer}">
|
<ScrollViewer x:Name="LayoutsScrollViewer" MaxHeight="250" VerticalScrollBarVisibility="Auto" Template="{StaticResource SmallBarScrollViewer}">
|
||||||
<StackPanel x:Name="LayoutsStackPanel" />
|
<StackPanel x:Name="LayoutsStackPanel" />
|
||||||
|
|
|
@ -45,7 +45,14 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
|
||||||
InitializeLayouts();
|
InitializeLayouts();
|
||||||
|
|
||||||
keyboard.LayoutChanged += Keyboard_LayoutChanged;
|
keyboard.LayoutChanged += Keyboard_LayoutChanged;
|
||||||
Button.Click += (o, args) => Popup.IsOpen = !Popup.IsOpen;
|
Button.Click += (o, args) =>
|
||||||
|
{
|
||||||
|
Popup.IsOpen = !Popup.IsOpen;
|
||||||
|
Task.Delay(200).ContinueWith(_ => this.Dispatcher.BeginInvoke((System.Action)(() =>
|
||||||
|
{
|
||||||
|
((LayoutsStackPanel.Children[0] as ContentControl).Content as UIElement).Focus();
|
||||||
|
})));
|
||||||
|
};
|
||||||
Button.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => Popup.IsOpen = Popup.IsMouseOver));
|
Button.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => Popup.IsOpen = Popup.IsMouseOver));
|
||||||
Popup.CustomPopupPlacementCallback = new CustomPopupPlacementCallback(Popup_PlacementCallback);
|
Popup.CustomPopupPlacementCallback = new CustomPopupPlacementCallback(Popup_PlacementCallback);
|
||||||
Popup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => Popup.IsOpen = IsMouseOver));
|
Popup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => Popup.IsOpen = IsMouseOver));
|
||||||
|
@ -114,5 +121,14 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
|
||||||
LayoutCultureCode.Text = layout.CultureCode;
|
LayoutCultureCode.Text = layout.CultureCode;
|
||||||
Button.ToolTip = tooltip;
|
Button.ToolTip = tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Popup_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == System.Windows.Input.Key.Enter || e.Key == System.Windows.Input.Key.Escape)
|
||||||
|
{
|
||||||
|
Popup.IsOpen = false;
|
||||||
|
Button.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue