Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MopigamesYT committed Jan 29, 2025
1 parent d38b23e commit 1b067f2
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
<converters:ScaleConverter x:Key="ScaleConverter"/>
<converters:StringToVisibilityConverter x:Key="StringToVisibilityConverter"/>
<converters:InverseBoolConverter x:Key="InverseBoolConverter"/>
<converters:VisibilityToBoolConverter x:Key="VisibilityToBoolConverter"/>

<!-- ComboBox Style -->
<Style x:Key="ModernComboBox" TargetType="ComboBox">
Expand Down
16 changes: 16 additions & 0 deletions Converters/InverseBoolConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Windows.Data;
namespace Libertix.Converters
{
public class InverseBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value is bool boolValue ? !boolValue : true;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value is bool boolValue ? !boolValue : true;
}
}
}
20 changes: 20 additions & 0 deletions Converters/VisibilityToBoolConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace Libertix.Converters
{
public class VisibilityToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is Visibility visibility && visibility == Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is bool boolValue && boolValue
? Visibility.Visible
: Visibility.Collapsed;
}
}
}
2 changes: 2 additions & 0 deletions Libertix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Converters\InverseBoolConverter.cs" />
<Compile Include="Converters\VisibilityToBoolConverter.cs" />
<Compile Include="Models\DistroInfo.cs" />
<Compile Include="Models\AccountInfo.cs" />
<Compile Include="Models\PageState.cs" />
Expand Down

0 comments on commit 1b067f2

Please sign in to comment.