Remove CollapsedWhen/VisibleWhen extension constructors with two arguments, forcing the user to explicitly specify IsEqualTo for clarity

This commit is contained in:
Yusyuriv 2024-05-17 20:54:26 +06:00
parent 88e7000155
commit 61d3758359
No known key found for this signature in database
GPG key ID: A91C52E6F73148E0
4 changed files with 4 additions and 12 deletions

View file

@ -39,12 +39,6 @@ public class CollapsedWhenExtension : MarkupExtension {
When = when;
}
public CollapsedWhenExtension(Binding when, object? isEqualTo)
{
When = when;
IsEqualTo = isEqualTo;
}
public override object ProvideValue(IServiceProvider serviceProvider) {
if (serviceProvider.GetService(typeof(IProvideValueTarget)) is not IProvideValueTarget provideValueTarget)
return DependencyProperty.UnsetValue;

View file

@ -11,6 +11,4 @@ public class VisibleWhenExtension : CollapsedWhenExtension
protected override Visibility InvertedVisibility => Visibility.Visible;
public VisibleWhenExtension(Binding when) : base(when) { }
public VisibleWhenExtension(Binding when, object? isEqualTo) : base(when, isEqualTo) { }
}

View file

@ -65,7 +65,7 @@
SelectedValue="{Binding Settings.CustomScreenNumber}"
Visibility="{ext:VisibleWhen
{Binding Settings.SearchWindowScreen},
{x:Static userSettings:SearchWindowScreens.Custom}}"
IsEqualTo={x:Static userSettings:SearchWindowScreens.Custom}}"
/>
</StackPanel>
</cc:Card>
@ -75,7 +75,7 @@
Title="{DynamicResource SearchWindowAlign}"
Visibility="{ext:CollapsedWhen
{Binding Settings.SearchWindowScreen},
{x:Static userSettings:SearchWindowScreens.RememberLastLaunchLocation}}">
IsEqualTo={x:Static userSettings:SearchWindowScreens.RememberLastLaunchLocation}}">
<StackPanel Orientation="Horizontal">
<ComboBox
MinWidth="160"
@ -92,7 +92,7 @@
VerticalAlignment="Center"
Visibility="{ext:VisibleWhen
{Binding Settings.SearchWindowAlign},
{x:Static userSettings:SearchWindowAligns.Custom}}">
IsEqualTo={x:Static userSettings:SearchWindowAligns.Custom}}">
<TextBox VerticalAlignment="Center" MinWidth="80"
Text="{Binding Settings.CustomWindowLeft}" />
<TextBlock VerticalAlignment="Center" Margin="10" Text="x" />

View file

@ -425,7 +425,7 @@
TextWrapping="NoWrap"
Visibility="{ext:VisibleWhen
{Binding Settings.AnimationSpeed},
{x:Static userSettings:AnimationSpeeds.Custom}}" />
IsEqualTo={x:Static userSettings:AnimationSpeeds.Custom}}" />
</StackPanel>
</cc:Card>
</cc:CardGroup>