Browse Source

Added missing Converter.

pull/1831/head
William David Cossey 8 years ago
parent
commit
d4b9ef5042
  1. 32
      src/Avalonia.Controls/Converters/MarginMultiplierConverter.cs

32
src/Avalonia.Controls/Converters/MarginMultiplierConverter.cs

@ -0,0 +1,32 @@
using System;
using System.Globalization;
using Avalonia.Data.Converters;
namespace Avalonia.Controls.Converters
{
public class MarginMultiplierConverter : IValueConverter
{
public double Indent { get; set; }
public bool Left { get; set; } = false;
public bool Top { get; set; } = false;
public bool Right { get; set; } = false;
public bool Bottom { get; set; } = false;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is int depth))
return new Thickness(0);
return new Thickness(Left ? Indent * depth : 0, Top ? Indent * depth : 0, Right ? Indent * depth : 0, Bottom ? Indent * depth : 0);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new System.NotImplementedException();
}
}
}
Loading…
Cancel
Save