using System; using System.Collections.Generic; using System.Text; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using OwlCore.AbstractUI.Models; using OwlCore.AbstractUI.ViewModels; using CommunityToolkit.Diagnostics; using OwlCore.WinUI.AbstractUI.Controls; using Windows.UI.Xaml.Data; namespace OwlCore.WinUI.AbstractUI.Themes { /// /// Selects the template that is used for an based on the . /// public class AbstractButtonTemplateSelector : IValueConverter { /// /// The data template used to a display an with a generic style. /// public Style? GenericStyle { get; set; } /// /// The data template used to a display an with a confirmation style. /// public Style? ConfirmStyle { get; set; } /// /// The data template used to a display an with a deletion style. /// public Style? DeleteStyle { get; set; } /// public object Convert(object value, Type targetType, object parameter, string language) { var type = AbstractButtonType.Generic; if (value is AbstractButtonType vType) type = vType; if (value is AbstractButtonViewModel buttonViewModel) type = buttonViewModel.Type; else if (value is AbstractButton button) type = button.Type; return type switch { AbstractButtonType.Generic => GenericStyle ?? ThrowHelper.ThrowArgumentNullException