Flow.Launcher/Flow.Launcher.Avalonia/Converters/BoolToIsVisibleConverter.cs
Hongtao Zhang 4120407ac3 Add initial Avalonia UI project for migration
Create Flow.Launcher.Avalonia project as foundation for migrating from WPF to Avalonia UI framework.

Key components:
- MainWindow with query box and results list (matching WPF layout)
- ViewModels: MainViewModel, ResultsViewModel, ResultViewModel
- Themes/Base.axaml with converted styles from WPF
- FluentAvaloniaUI for Windows 11 styling
- References existing Core/Infrastructure/Plugin projects

The project builds and runs alongside the existing WPF application.
This is Phase 1 of the incremental migration approach.
2026-01-14 23:01:35 -08:00

34 lines
957 B
C#

using System;
using System.Globalization;
using Avalonia.Data.Converters;
namespace Flow.Launcher.Avalonia.Converters;
/// <summary>
/// Converts a boolean value to IsVisible (Avalonia uses bool for visibility, not Visibility enum)
/// </summary>
public class BoolToIsVisibleConverter : IValueConverter
{
/// <summary>
/// If true, inverts the boolean value (true becomes false, false becomes true)
/// </summary>
public bool Invert { get; set; }
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is bool boolValue)
{
return Invert ? !boolValue : boolValue;
}
return false;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is bool boolValue)
{
return Invert ? !boolValue : boolValue;
}
return false;
}
}