mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 06:29:44 +08:00
ImageResizer: skip Settings tab focus when hidden
This commit is contained in:
parent
49811fc4b8
commit
ccf02579e6
@ -23,6 +23,7 @@
|
||||
<v:EnumValueConverter x:Key="EnumValueConverter"/>
|
||||
<v:AutoDoubleConverter x:Key="AutoDoubleConverter"/>
|
||||
<v:BoolValueConverter x:Key="BoolValueConverter"/>
|
||||
<v:VisibilityBoolConverter x:Key="VisibilityBoolConverter"/>
|
||||
<Style x:Key="MainInstructionTextBlockStyle" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="12pt"/>
|
||||
<Setter Property="Foreground" Value="#039"/>
|
||||
|
@ -16,6 +16,6 @@ namespace ImageResizer.Views
|
||||
=> (bool)value ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> throw new NotImplementedException();
|
||||
=> (Visibility)value == Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
@ -130,9 +130,12 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock VerticalAlignment="Center"
|
||||
Visibility="{Binding ShowAdvancedSettings, Converter={StaticResource BoolValueConverter}}">
|
||||
|
||||
<TextBlock x:Name="AdvancedSettingsTextBlock"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding ShowAdvancedSettings, Converter={StaticResource BoolValueConverter}}"
|
||||
IsEnabled="{Binding Visibility,ElementName=AdvancedSettingsTextBlock, Converter={StaticResource VisibilityBoolConverter}}"
|
||||
Focusable="{Binding Visibility,ElementName=AdvancedSettingsTextBlock, Converter={StaticResource VisibilityBoolConverter}}">
|
||||
<local:AccessibleHyperlink ControlType="Button" Command="{Binding ShowAdvancedCommand}">
|
||||
<Run Text="{x:Static p:Resources.Input_ShowAdvanced}"/>
|
||||
</local:AccessibleHyperlink>
|
||||
|
21
src/modules/imageresizer/ui/Views/VisibilityBoolConverter.cs
Normal file
21
src/modules/imageresizer/ui/Views/VisibilityBoolConverter.cs
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (c) Brice Lambson
|
||||
// The Brice Lambson licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ImageResizer.Views
|
||||
{
|
||||
[ValueConversion(typeof(Visibility), typeof(bool))]
|
||||
internal class VisibilityBoolConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> (Visibility)value == Visibility.Visible;
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> (bool)value ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user