add HatchBrushGenerator

This commit is contained in:
NaBian committed 2019-09-23 00:20:53 +08:00
1 parent 3d5e5a4306
commit 994c9e642f
25 files changed
+382 -42

No files matched your search

@@ -0,0 +1,33 @@
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using HandyControl.Data;
using HandyControl.Tools;
namespace HandyControlDemo.Tools.Converter
{
public class HatchBrushConverter : IValueConverter
{
private readonly HatchBrushGenerator _brushGenerator;
public HatchBrushConverter()
{
_brushGenerator = new HatchBrushGenerator();
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is HatchStyle style)
{
return _brushGenerator.GetHatchBrush(style, ResourceHelper.GetResource<Color>("DarkPrimaryColor"), ResourceHelper.GetResource<Color>("BackgroundColor"));
}
return Brushes.Transparent;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}