Files

27 lines
657 B
C#
Raw Permalink Normal View History

2025-11-15 14:52:01 +01:00
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;
}
}