mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
26 lines
930 B
C#
26 lines
930 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace Wabbajack
|
|
{
|
|
public class WidthHeightRectConverter : IMultiValueConverter
|
|
{
|
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
double rectWidth = 0;
|
|
double rectHeight = 0;
|
|
if (values[0] is not null && double.TryParse(values[0].ToString(), out var width))
|
|
rectWidth = width;
|
|
else return null;
|
|
if (values[1] is not null && double.TryParse(values[1].ToString(), out var height))
|
|
rectHeight = height;
|
|
else return null;
|
|
return new Rect(0, 0, rectWidth, rectHeight);
|
|
}
|
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
|
=> throw new NotImplementedException();
|
|
}
|
|
}
|