first commit

This commit is contained in:
2025-07-06 00:23:46 +02:00
commit 38f50c8819
1788 changed files with 112878 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
using System;
using System.Globalization;
using Avalonia;
namespace Nitrox.Launcher.Models.Converters;
/// <summary>
/// Formats the bound value as "0 BoundValue 0 BoundValue" Margin from a Padding, used for TextBox styling.
/// </summary>
/// <remarks>
/// This converter is used to solve a niche issue with the styling of TextBoxes.
/// </remarks>
public class TextBoxPaddingToMarginConverter : Converter<TextBoxPaddingToMarginConverter>
{
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is not Thickness padding)
{
return value;
}
bool isNegative = parameter != null && bool.TryParse(parameter.ToString(), out bool result) && result;
double top = isNegative ? -padding.Top : padding.Top;
double bottom = isNegative ? -padding.Bottom : padding.Bottom;
return new Thickness(0, top, 0, bottom);
}
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}