Skip to content

Adjust Signature PanelBar KB sample behavior and normalize article metadata#3665

Merged
IvanDanchev merged 5 commits into
masterfrom
copilot/fix-signature-component-in-panelbar
Jun 3, 2026
Merged

Adjust Signature PanelBar KB sample behavior and normalize article metadata#3665
IvanDanchev merged 5 commits into
masterfrom
copilot/fix-signature-component-in-panelbar

Conversation

Copilot AI commented May 10, 2026

Copy link
Copy Markdown
Contributor

This PR updates the Signature-in-PanelBar KB article to refine the sample behavior and correct frontmatter metadata values.

  • Sample behavior updates

    • Updated the KB example to use a simplified, flat PanelBarData structure.
    • Keeps explicit SignatureItem tracking and expansion-state handling in OnExpandedItemsChanged.
    • Initializes ExpandedItems with only the Signature item.
    • Uses a shorter delay (Task.Delay(100)) in OnAfterRenderAsync.
  • Frontmatter metadata normalization

    • Removed empty position from the article metadata.
    • Removed animation from tags.
    • Set ticketid to 1712712.
ExpandedItems = new List<object> { SignatureItem };

Copilot AI and others added 3 commits May 10, 2026 15:27
Comment thread knowledge-base/signature-panelbar-contenttemplate-offset-strokes.md Outdated
Comment thread knowledge-base/signature-panelbar-contenttemplate-offset-strokes.md Outdated
@IvanDanchev

Copy link
Copy Markdown
Contributor

@copilot

Change the example in the article with the following one:

<div class="panelbar-template">
    <TelerikPanelBar Data="@PanelBarData"
                     ExpandedItems="@ExpandedItems"
                     ExpandedItemsChanged="@OnExpandedItemsChanged">
        <PanelBarBindings>
            <PanelBarBinding ItemsField="@nameof(PanelBarItem.Items)">
                <ContentTemplate>
                    @{
                        var item = (PanelBarItem)context;
                    }

                    @if (item.Text == "Sign Here")
                    {
                        if (ShowSignature)
                        {
                            <TelerikSignature @bind-Value="@SignatureValue"
                                              Width="320px"
                                              Height="180px" />
                        }
                    }
                    else
                    {
                        <div>@item.Text</div>
                    }
                </ContentTemplate>
            </PanelBarBinding>
        </PanelBarBindings>
    </TelerikPanelBar>
</div>

<style>
    .panelbar-template {
        margin: 0 auto;
        width: 400px;
    }
</style>

@code {
    private List<PanelBarItem> PanelBarData { get; set; } = new();
    private IEnumerable<object> ExpandedItems { get; set; } = new List<object>();
    private string SignatureValue { get; set; } = string.Empty;

    private bool ShowSignature { get; set; }
    private bool ShowSignaturePending { get; set; }
    private int SignatureVersion { get; set; }

    private PanelBarItem? SignatureItem { get; set; }

    private void OnExpandedItemsChanged(IEnumerable<object> items)
    {
        var expandedList = items.ToList();

        bool signatureWasExpanded = ExpandedItems.Contains(SignatureItem);
        bool signatureIsExpanding = SignatureItem != null && expandedList.Contains(SignatureItem);

        ExpandedItems = expandedList;

        if (!signatureWasExpanded && signatureIsExpanding)
        {
            ShowSignature = false;
            ShowSignaturePending = true;
        }
    }

    private void LoadData()
    {
        SignatureItem = new PanelBarItem { Text = "Sign Here" };

        var documentsItem = new PanelBarItem
        {
            Text = "Documents",
            Items = new List<PanelBarItem>
            {
                new() { Text = "Reports" },
                SignatureItem
            }
        };

        PanelBarData = new List<PanelBarItem>
        {
            documentsItem,
            new() { Text = "Settings" }
        };

        ExpandedItems = new List<object> { documentsItem, SignatureItem };
    }

    protected override void OnInitialized()
    {
        LoadData();
        ShowSignature = false;
        ShowSignaturePending = true;
    }

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender || ShowSignaturePending)
        {
            ShowSignaturePending = false;

            var version = ++SignatureVersion;
            await Task.Delay(100);

            if (SignatureVersion == version)
            {
                ShowSignature = true;
                StateHasChanged();
            }
        }
    }

    public class PanelBarItem
    {
        public string Text { get; set; } = string.Empty;
        public List<PanelBarItem>? Items { get; set; }
    }
}

Copilot AI commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

Change the example in the article with the following one:
...

Updated the article example as requested in commit f48784d.

Copilot AI requested a review from IvanDanchev June 3, 2026 10:21
@IvanDanchev IvanDanchev marked this pull request as ready for review June 3, 2026 10:26
@IvanDanchev IvanDanchev requested a review from a team as a code owner June 3, 2026 10:26
@IvanDanchev IvanDanchev requested a review from dimodi June 3, 2026 10:26
@IvanDanchev IvanDanchev added the merge-to-production Use this label to get a comment to choose whether to merge the PR to production label Jun 3, 2026
Comment thread knowledge-base/signature-panelbar-contenttemplate-offset-strokes.md
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Hello @IvanDanchev,

Check the below option if you would like to automatically generate PR to production. The automation uses the branch for the cherry-pick, and then will delete the branch. Please, do not delete it manually.

  • create PR to production

@IvanDanchev

Copy link
Copy Markdown
Contributor

@copilot

Replace the example in the article, with the one below:

<div class="panelbar-template">
    <TelerikPanelBar Data="@PanelBarData"
                     ExpandedItems="@ExpandedItems"
                     ExpandedItemsChanged="@OnExpandedItemsChanged">
        <PanelBarBindings>
            <PanelBarBinding ItemsField="@nameof(PanelBarItem.Items)">
                <ContentTemplate>
                    @{
                        var item = (PanelBarItem)context;
                    }

                    @if (item.Text == "Sign Here")
                    {
                        if (ShowSignature)
                        {
                            <TelerikSignature @bind-Value="@SignatureValue"
                                              Width="320px"
                                              Height="180px" />
                        }
                    }
                    else
                    {
                        <div>@item.Text</div>
                    }
                </ContentTemplate>
            </PanelBarBinding>
        </PanelBarBindings>
    </TelerikPanelBar>
</div>

<style>
    .panelbar-template {
        margin: 0 auto;
        width: 400px;
    }
</style>

@code {
    private List<PanelBarItem> PanelBarData { get; set; } = new();
    private IEnumerable<object> ExpandedItems { get; set; } = new List<object>();
    private string SignatureValue { get; set; } = string.Empty;

    private bool ShowSignature { get; set; }
    private bool ShowSignaturePending { get; set; }
    private int SignatureVersion { get; set; }

    private PanelBarItem? SignatureItem { get; set; }

    private void OnExpandedItemsChanged(IEnumerable<object> items)
    {
        var expandedList = items.ToList();

        bool signatureWasExpanded = ExpandedItems.Contains(SignatureItem);
        bool signatureIsExpanding = SignatureItem != null && expandedList.Contains(SignatureItem);

        ExpandedItems = expandedList;

        if (!signatureWasExpanded && signatureIsExpanding)
        {
            ShowSignature = false;
            ShowSignaturePending = true;
        }
    }

    private void LoadData()
    {
        SignatureItem = new PanelBarItem { Text = "Sign Here" };

        PanelBarData = new List<PanelBarItem>
        {
            new() { Text = "Documents" },
            new() { Text = "Reports" },
            SignatureItem,
            new() { Text = "Settings" }
        };

        ExpandedItems = new List<object> { SignatureItem };
    }

    protected override void OnInitialized()
    {
        LoadData();
        ShowSignature = false;
        ShowSignaturePending = true;
    }

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender || ShowSignaturePending)
        {
            ShowSignaturePending = false;

            var version = ++SignatureVersion;
            await Task.Delay(100);

            if (SignatureVersion == version)
            {
                ShowSignature = true;
                StateHasChanged();
            }
        }
    }

    public class PanelBarItem
    {
        public string Text { get; set; } = string.Empty;
        public List<PanelBarItem>? Items { get; set; }
    }
}

Copilot AI commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

Replace the example in the article, with the one below:
...

Updated the article example as requested in commit 875b853.

Copilot AI changed the title Adjust Signature PanelBar KB sample default expansion and normalize article metadata Adjust Signature PanelBar KB sample behavior and normalize article metadata Jun 3, 2026
@IvanDanchev IvanDanchev merged commit 2214f6b into master Jun 3, 2026
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Here you are the link to your PR to production: #3719

@github-actions github-actions Bot deleted the copilot/fix-signature-component-in-panelbar branch June 3, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-to-production Use this label to get a comment to choose whether to merge the PR to production

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants