ant-design-blazor / ant-design-blazor

🌈A set of enterprise-class UI components based on Ant Design and Blazor.

Home Page:https://antblazor.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to toggle Panel by Active attribute

shirleen1234 opened this issue · comments

Describe the bug

Failed to change the active state of a Panel using the Active attribute.

Steps to reproduce (please include code)

<Button Shape="circle" Icon="@(_expandAll ? "up" : "down")" OnClick="@ToggleExpandAll" />

<Collapse DefaultActiveKey="@(new[]{"1"})" OnChange="Callback" Animation>
    <Panel Header="This is panel header 1" Key="1" Active="_expandAll">
        <p>@text</p>
    </Panel>
    <Panel Key="2" Active="_expandAll">
        <HeaderTemplate>
            This is panel header 2
        </HeaderTemplate>
        <ChildContent>
            <p>@text</p>
        </ChildContent>
    </Panel>
    <Panel Header="This is panel header 3" Key="3" Disabled Active="_expandAll">
        <p>@text</p>
    </Panel>
</Collapse>

@code {
    bool _expandAll;

    void Callback(string[] keys)
    {
        Console.WriteLine(string.Join(',', keys));
    }

    private void ToggleExpandAll()
    {
        _expandAll = !_expandAll;

        StateHasChanged();
    }
}

Exceptions (if any)

Further technical details

  • AntDesign Nuget Package v0.19.0