Files
Shrlalgo.RvKits/WPFluent/Converters/IconSourceElementConverter.cs

45 lines
1.5 KiB
C#
Raw Normal View History


using System.Windows.Data;
2025-04-24 20:56:44 +08:00
using WPFluent.Controls;
namespace WPFluent.Converters;
/// <summary>
/// Converts an <see cref="IconSourceElement"/> to an <see cref="IconElement"/>.
/// </summary>
2025-04-24 20:56:44 +08:00
internal class IconSourceElementConverter : IValueConverter
{
/// <summary>
/// Converts a value to an <see cref="IconElement"/>.
/// </summary>
/// <param name="value">The value to convert.</param>
/// <param name="targetType">The type of the binding target property.</param>
/// <param name="parameter">The converter parameter.</param>
/// <param name="culture">The culture to use in the converter.</param>
/// <returns>The converted <see cref="IconElement"/>.</returns>
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
2025-04-24 20:56:44 +08:00
if (value is IconSourceElement iconSourceElement)
{
return iconSourceElement.CreateIconElement();
}
return value;
}
/// <summary>
/// Converts an <see cref="IconElement"/> back to an IconSourceElement.
/// </summary>
/// <param name="value">The value to convert.</param>
/// <param name="targetType">The type of the binding target property.</param>
/// <param name="parameter">The converter parameter.</param>
/// <param name="culture">The culture to use in the converter.</param>
/// <returns>The converted IconSourceElement.</returns>
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{ throw new NotImplementedException(); }
}