SectionContent.razor.cs
using System;
using Sandbox.Diagnostics;
namespace BetterUI;
/// <summary>
/// A panel that displays content in all <see cref="SectionOutlet"/>s
/// with the same <see cref="SectionName"/>.
/// </summary>
/// <remarks>
/// This panel will automatically be rendered in all
/// <see cref="SectionOutlet"/>s with the same <see cref="SectionName"/>.
/// </remarks>
public sealed partial class SectionContent : Panel
{
/// <summary>
/// The name of the section this content belongs to.
/// </summary>
public string SectionName { get; set; } = null!;
protected override void OnAfterTreeRender( bool firstTime )
{
Assert.NotNull( SectionName, $"{nameof(SectionName)} must be set" );
}
protected override int BuildHash() => HashCode.Combine( SectionName );
}