Files
Wino-Mail/Wino.Core.UWP/Converters/GridLengthConverter.cs

28 lines
731 B
C#
Raw Normal View History

2024-08-19 16:26:15 +02:00
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
2024-08-19 16:26:15 +02:00
namespace Wino.Converters
{
public partial class GridLengthConverter : IValueConverter
2024-08-19 16:26:15 +02:00
{
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;
}
}
}