You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
712 B
29 lines
712 B
using System;
|
|
using System.Globalization;
|
|
|
|
namespace LolApp.Resources.Converters
|
|
{
|
|
public class ImageRatioConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
try
|
|
{
|
|
double parentWidth = (double)value;
|
|
double ratio = (double)parameter;
|
|
return parentWidth*ratio;
|
|
}
|
|
catch
|
|
{
|
|
return 0.0;
|
|
}
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|
|
|