mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 04:37:30 +02:00
Added logic that disables input boxes when Custom size is not selected
This commit is contained in:
@@ -6,6 +6,30 @@
|
|||||||
xmlns:p="clr-namespace:ImageResizer.Properties"
|
xmlns:p="clr-namespace:ImageResizer.Properties"
|
||||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||||
MinWidth="350">
|
MinWidth="350">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<Style x:Key="DisabledWhenUnselectedComboBoxStyle" TargetType="ComboBox" BasedOn="{StaticResource DefaultComboBoxStyle}">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="True">
|
||||||
|
<Setter Property="IsEnabled" Value="True"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="False">
|
||||||
|
<Setter Property="IsEnabled" Value="False"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="DisabledWhenUnselectedTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource DefaultTextBoxStyle}">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="True">
|
||||||
|
<Setter Property="IsEnabled" Value="True"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="False">
|
||||||
|
<Setter Property="IsEnabled" Value="False"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</UserControl.Resources>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<StackPanel Background="{DynamicResource PrimaryBackgroundBrush}">
|
<StackPanel Background="{DynamicResource PrimaryBackgroundBrush}">
|
||||||
<Label Margin="12,12,12,0"
|
<Label Margin="12,12,12,0"
|
||||||
@@ -62,6 +86,7 @@
|
|||||||
FontWeight="Bold"/>
|
FontWeight="Bold"/>
|
||||||
<ComboBox Margin="8,0,0,0"
|
<ComboBox Margin="8,0,0,0"
|
||||||
ItemsSource="{Binding Source={StaticResource ResizeFitValues}}"
|
ItemsSource="{Binding Source={StaticResource ResizeFitValues}}"
|
||||||
|
Style="{StaticResource DisabledWhenUnselectedComboBoxStyle}"
|
||||||
SelectedItem="{Binding Fit}">
|
SelectedItem="{Binding Fit}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate DataType="{x:Type m:ResizeFit}">
|
<DataTemplate DataType="{x:Type m:ResizeFit}">
|
||||||
@@ -70,8 +95,8 @@
|
|||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<TextBox Width="56"
|
<TextBox Width="56"
|
||||||
Style="{StaticResource DefaultTextBoxStyle}"
|
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
|
Style="{StaticResource DisabledWhenUnselectedTextBoxStyle}"
|
||||||
Margin="8,0,0,0">
|
Margin="8,0,0,0">
|
||||||
<TextBox.Text>
|
<TextBox.Text>
|
||||||
<Binding Converter="{StaticResource AutoDoubleConverter}"
|
<Binding Converter="{StaticResource AutoDoubleConverter}"
|
||||||
@@ -88,8 +113,7 @@
|
|||||||
Visibility="{Binding ShowHeight,Converter={StaticResource BoolValueConverter}}"/>
|
Visibility="{Binding ShowHeight,Converter={StaticResource BoolValueConverter}}"/>
|
||||||
|
|
||||||
<TextBox Width="56"
|
<TextBox Width="56"
|
||||||
Style="{StaticResource DefaultTextBoxStyle}"
|
Style="{StaticResource DisabledWhenUnselectedTextBoxStyle}"
|
||||||
Margin="0,0,0,0"
|
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
Visibility="{Binding ShowHeight,Converter={StaticResource BoolValueConverter}}">
|
Visibility="{Binding ShowHeight,Converter={StaticResource BoolValueConverter}}">
|
||||||
<TextBox.Text>
|
<TextBox.Text>
|
||||||
@@ -104,6 +128,7 @@
|
|||||||
</TextBox>
|
</TextBox>
|
||||||
<ComboBox Margin="8,0,0,0"
|
<ComboBox Margin="8,0,0,0"
|
||||||
ItemsSource="{Binding Source={StaticResource ResizeUnitValues}}"
|
ItemsSource="{Binding Source={StaticResource ResizeUnitValues}}"
|
||||||
|
Style="{StaticResource DisabledWhenUnselectedComboBoxStyle}"
|
||||||
SelectedItem="{Binding Unit}">
|
SelectedItem="{Binding Unit}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate DataType="{x:Type m:ResizeUnit}">
|
<DataTemplate DataType="{x:Type m:ResizeUnit}">
|
||||||
|
|||||||
Reference in New Issue
Block a user