fix missing rename from page to tabpanel
This commit is contained in:
parent
e551ec2213
commit
e0347e5e99
|
@ -3,11 +3,11 @@
|
|||
|
||||
<CascadingValue Value="this">
|
||||
<div>
|
||||
@foreach (TabPanel tabPanel in Pages)
|
||||
@foreach (TabPanel tabPanel in TabPanels)
|
||||
{
|
||||
<button type="button"
|
||||
class="btn @GetButtonClass(tabPanel)"
|
||||
@onclick=@( () => ActivatePage(tabPanel) )>
|
||||
@onclick=@( () => ActivateTabPanel(tabPanel) )>
|
||||
@tabPanel.Text
|
||||
</button>
|
||||
}
|
||||
|
@ -20,24 +20,24 @@
|
|||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; }
|
||||
|
||||
public TabPanel ActivePage { get; set; }
|
||||
List<TabPanel> Pages = new List<TabPanel>();
|
||||
public TabPanel ActiveTabPanel { get; set; }
|
||||
List<TabPanel> TabPanels = new List<TabPanel>();
|
||||
|
||||
internal void AddPage(TabPanel tabPanel)
|
||||
internal void AddTabPanel(TabPanel tabPanel)
|
||||
{
|
||||
Pages.Add(tabPanel);
|
||||
if (Pages.Count == 1)
|
||||
ActivePage = tabPanel;
|
||||
TabPanels.Add(tabPanel);
|
||||
if (TabPanels.Count == 1)
|
||||
ActiveTabPanel = tabPanel;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
string GetButtonClass(TabPanel page)
|
||||
string GetButtonClass(TabPanel tabPanel)
|
||||
{
|
||||
return page == ActivePage ? "btn-primary" : "btn-secondary";
|
||||
return tabPanel == ActiveTabPanel ? "btn-primary" : "btn-secondary";
|
||||
}
|
||||
|
||||
void ActivatePage(TabPanel page)
|
||||
void ActivateTabPanel(TabPanel tabPanel)
|
||||
{
|
||||
ActivePage = page;
|
||||
ActiveTabPanel = tabPanel;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ThemeControlBase
|
||||
|
||||
@if (Parent.ActivePage == (TabPanel)(object)this)
|
||||
@if (Parent.ActiveTabPanel == (TabPanel)(object)this)
|
||||
{
|
||||
@ChildContent
|
||||
}
|
||||
|
@ -22,6 +22,6 @@
|
|||
throw new ArgumentNullException(nameof(Parent), "TabPanel must exist within a TabControl");
|
||||
|
||||
base.OnInitialized();
|
||||
Parent.AddPage((TabPanel)(object)this);
|
||||
Parent.AddTabPanel((TabPanel)(object)this);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user