Files
Wino-Mail/Wino.Core.WinUI/Converters/GridLengthConverter.cs
T
2025-09-29 11:16:14 +02:00

27 lines
657 B
C#

using System;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Data;
namespace Wino.Converters;
public partial class GridLengthConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is double doubleValue)
{
return new GridLength(doubleValue);
}
return new GridLength(1, GridUnitType.Auto);
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (value is GridLength gridLength)
{
return gridLength.Value;
}
return 0.0;
}
}