using Avalonia.Controls; using Avalonia.Data.Converters; using Avalonia.Media; using Avalonia; using System.Runtime.InteropServices; namespace SourceGit.Converters { public static class WindowStateConverters { public static FuncValueConverter ToContentMargin = new FuncValueConverter(state => { if (state == WindowState.Maximized && RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return new Thickness(6); } else { return new Thickness(0); } }); public static FuncValueConverter ToTitleBarHeight = new FuncValueConverter(state => { if (state == WindowState.Maximized && RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return new GridLength(30); } else { return new GridLength(38); } }); public static FuncValueConverter ToMaxOrRestoreIcon = new FuncValueConverter(state => { if (state == WindowState.Maximized) { return Application.Current?.FindResource("Icons.Window.Restore") as StreamGeometry; } else { return Application.Current?.FindResource("Icons.Window.Maximize") as StreamGeometry; } }); } }