using System.Windows.Markup; // ReSharper disable once CheckNamespace namespace WPFluent.Controls; /// /// Represents an icon that uses an IconSource as its content. /// [ContentProperty(nameof(IconSource))] public class IconSourceElement : IconElement { /// /// Identifies the dependency property. /// public static readonly DependencyProperty IconSourceProperty = DependencyProperty.Register( nameof(IconSource), typeof(Controls.IconSource), typeof(IconSourceElement), new FrameworkPropertyMetadata(null)); protected override UIElement InitializeChildren() { // TODO: Come up with an elegant solution throw new InvalidOperationException($"Use {nameof(CreateIconElement)}"); } public IconElement? CreateIconElement() { return IconSource?.CreateIconElement(); } /// /// Gets or sets /// public Controls.IconSource? IconSource { get => (Controls.IconSource?)GetValue(IconSourceProperty); set => SetValue(IconSourceProperty, value); } }