Code/DynamicNotificationPanel.cs
using System;
namespace BetterUI;
/// <summary>
/// A dynamic panel that will create a new panel when the type it represents is changed.
/// The new panel will be created from the type specified in the <see cref="NotificationViewAttribute"/>.
/// </summary>
internal class DynamicNotificationPanel : DynamicPanel
{
protected override void OnAfterTreeRender( bool firstTime )
{
var panelType = TypeLibrary.GetAttribute<NotificationViewAttribute>( Type );
if ( panelType is null ) return;
Type = panelType.Type;
base.OnAfterTreeRender( firstTime );
}
protected override int BuildHash() => HashCode.Combine( Type, Attributes, Attributes.Count );
}