File: Platform\Windows\IconConverter.cs
Web Access
Project: src\src\Controls\src\Core\Controls.Core.csproj (Microsoft.Maui.Controls)
#nullable disable
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Microsoft.Maui.Controls.Platform
{
	public partial class IconConverter : Microsoft.UI.Xaml.Data.IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, string language)
		{
			if (value is not ImageSource source)
				return null;
 
			var context = source.FindMauiContext(true);
			return source.ToIconSource(context).CreateIconElement();
		}
 
		public object ConvertBack(object value, Type targetType, object parameter, string language)
		{
			throw new NotSupportedException();
		}
	}
}