Add TabControl & TabPage
This commit is contained in:
27
Oqtane.Client/Themes/Controls/TabPage.razor
Normal file
27
Oqtane.Client/Themes/Controls/TabPage.razor
Normal file
@ -0,0 +1,27 @@
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ThemeControlBase
|
||||
|
||||
@if (Parent.ActivePage == (TabPage)(object)this)
|
||||
{
|
||||
@ChildContent
|
||||
}
|
||||
|
||||
@code {
|
||||
[CascadingParameter]
|
||||
private TabControl Parent { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string Text { get; set; }
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (Parent == null)
|
||||
throw new ArgumentNullException(nameof(Parent), "TabPage must exist within a TabControl");
|
||||
|
||||
base.OnInitialized();
|
||||
Parent.AddPage((TabPage)(object)this);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user