更新整理
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
|
||||
using WPFluent.Extensions;
|
||||
using WPFluent.Models;
|
||||
|
||||
using System;
|
||||
|
||||
using System.Windows.Data;
|
||||
|
||||
using WPFluent.Controls;
|
||||
using WPFluent.Extensions;
|
||||
|
||||
namespace WPFluent.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// Converts HSB color values to SolidColorBrush and vice versa. Supports single and multi-value conversions.
|
||||
/// </summary>
|
||||
public class HsbToColorConverter : IValueConverter, IMultiValueConverter
|
||||
internal class HsbToColorConverter : IValueConverter, IMultiValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if(value is Hsb hsb)
|
||||
if (value is Hsb hsb)
|
||||
return new SolidColorBrush(hsb.ToColor());
|
||||
return Binding.DoNothing;
|
||||
}
|
||||
@@ -29,7 +31,7 @@ public class HsbToColorConverter : IValueConverter, IMultiValueConverter
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if(value is SolidColorBrush brush)
|
||||
if (value is SolidColorBrush brush)
|
||||
return brush.Color.ToHsb();
|
||||
return Binding.DoNothing;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user