using PipeReviewReport.Resources.Fonts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; namespace Store.Management.Framework.Controls { public class IconText : TextBlock { static IconText() { DefaultStyleKeyProperty.OverrideMetadata(typeof(IconText), new FrameworkPropertyMetadata(typeof(IconText))); } public IconNameEnum Icon { get => (IconNameEnum)GetValue(IconNameProperty); set => SetValue(IconNameProperty, value); } public static readonly DependencyProperty IconNameProperty = DependencyProperty.Register( nameof(Icon), typeof(IconNameEnum), typeof(IconText), new PropertyMetadata(IconNameEnum.Empty, OnIconChanged) ); private static void OnIconChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d is IconText self) { self.Text = self.Icon.GetGlyphString(); } } } }