Unplanned
Last Updated: 14 Nov 2024 12:19 by ADMIN
Michael
Created on: 22 Apr 2020 12:29
Category: Window
Type: Feature Request
25
Animation for Window

It would be nice to be able to configure a show/hide animation for windows.

ADMIN EDIT: This might include a form of a Shown event so that you could know when the content is rendered and available to, for example, focus a button or input. For more details see here

14 comments
ADMIN
Hristian Stefanov
Posted on: 14 Nov 2024 12:19

Hi Erik,

Thank you for the update.

I'm happy to hear that you've found an effective solution that works for you while awaiting the release of the built-in functionality.

Regards,
Hristian Stefanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Erik
Posted on: 13 Nov 2024 17:42

Thank you Hristian Stefanov, that works pretty well:

In the VisibleChanged event I prevent the window from closing and instead invoke Javascript:

    void VisibleChangedHandler(bool currVisible)
    {
        var dotNetReference = DotNetObjectReference.Create(this);
        JSRuntime.InvokeVoidAsync("HideWindowAnimation", ".WinLocation", dotNetReference);
    }

The JavaScript adds the animation class to the Window element and then handles the animationend event where it invokes C# to finally change the Visible parameter of the Window:

    function HideWindowAnimation(el, dotNetObject) {
        const element = document.querySelector(el);
        element.addEventListener('animationend', () => {
            dotNetObject.invokeMethodAsync('HideWindowNow');
        });
       element.classList.add('WindowOutAnimation');

    }

Invokable C#:

    [JSInvokable("HideWindowNow")]
    public void HideWindowNow()
    {
        WindowIsVisible = false;
        StateHasChanged();
    }

 

This works pretty well, but will be much simpler when it is built in functionality...

ADMIN
Hristian Stefanov
Posted on: 13 Nov 2024 13:04

Hi Erik,

The Window’s closing action removes it from the DOM, meaning its HTML element is no longer available to apply a straightforward hide animation.

As a possible alternative, though a bit complex, you could handle the Window's VisibleChanged event to mimic hiding with CSS. You could use a CSS class that sets "display: none;" along with a CSS "transition" effect. Once the animation completes, you would then set the Visible parameter to false to actually close the Window.

    Regards,
    Hristian Stefanov
    Progress Telerik

    Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

    Erik
    Posted on: 12 Nov 2024 22:01
    Hristian Stefanov, I had figured out the CSS transitions on show, but is there an easy way to show the reverse transition when hiding the window?
    ADMIN
    Hristian Stefanov
    Posted on: 03 Sep 2024 16:38

    Hi Michael,

    Please accept our sincere apologies for the situation regarding this item.

    It was deprioritized in recent releases in favor of more urgent tasks. However, the item remains on the table and is highly likely to be delivered in the first half of 2025 (either the Q1 or Q2 release). It will also be included in the public roadmap.

    Alternative

    In the meantime, I have tested and found an alternative solution that uses only CSS for animations. Here is an example I have prepared:

    <style>
        /* Keyframes for sliding in from the left */
        @@keyframes slide-in {
            from {
                transform: translateX(-100%);
            }
    
            to {
                transform: translateX(0);
            }
        }
    
        /* Keyframes for fading in */
        @@keyframes fade-in {
            from {
                opacity: 0;
            }
    
            to {
                opacity: 1;
            }
        }
    
        /* Keyframes for bouncing in */
        @@keyframes bounce-in {
            from {
                transform: scale(0.5);
                opacity: 0;
            }
    
            50% {
                transform: scale(1.1);
                opacity: 1;
            }
    
            to {
                transform: scale(1);
            }
        }
    
        /* Animation classes */
        .slide-in {
            animation: slide-in 2s ease-out;
        }
    
        .fade-in {
            animation: fade-in 1.5s ease-in-out;
        }
    
        .bounce-in {
            animation: bounce-in 1.2s ease-out;
        }
    </style>
    
    <h3>Select Animation:</h3>
    
    <TelerikRadioGroup Data="@RadioGroupData" @bind-Value="@selectedAnimation" />
    
    <!-- Bind the CSS class dynamically based on the selected animation -->
    <TelerikWindow Class="@($"animated-container {selectedAnimation}")" @bind-Visible="@WindowIsVisible">
        <WindowTitle>
            Window Title
        </WindowTitle>
        <WindowContent>
            Window Content ...
        </WindowContent>
        <WindowActions>
            <WindowAction Name="Close" />
        </WindowActions>
        <WindowFooter>
            Window Footer Content ...
        </WindowFooter>
    </TelerikWindow>
    
    @code {
        private bool WindowIsVisible { get; set; } = true;
        private string selectedAnimation = "slide-in";
    
        private IEnumerable<string> RadioGroupData { get; set; } = new List<string> { "slide-in", "fade-in", "bounce-in" };
    
        private void SetAnimation(string animation)
        {
            selectedAnimation = animation;
    
            InvokeAsync(async () =>
            {
                await Task.Delay(10); // Small delay to ensure visibility state change
                WindowIsVisible = true;
            });
        }
    }

    Regards,
    Hristian Stefanov
    Progress Telerik

    Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

    Michael
    Posted on: 28 Aug 2024 15:04

    Hi Lyubomir,

     

    when exactly is this "soon" over? This post is about a year old. When do you expect to have this feature implemented?

     

    Regards
    Michael

    ADMIN
    Lyubomir
    Posted on: 26 Oct 2023 10:09

    Hi Ted, Michael, and everyone 

    I am Lyubomir, the Product Manager for Telerik UI for Blazor. I would like to apologize for any inconvenience caused by the recent roadmap changes.

    I understand the importance of this request to all of you, and we will very soon provide updated timelines for when we will be able to include this feature.

    Your understanding and ongoing support are greatly appreciated.

    Regards,
    Lyubomir
    Progress Telerik

    Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
    Ted
    Posted on: 19 Oct 2023 14:12
    Can you guys PLEASE get this feature added in soon! It is badly needed. We've based our purchase decisions on your roadmap commitments and expect you to stick by those, please.
    Michael
    Posted on: 19 Oct 2023 14:05

    Hi Hristian,

     

    so currently we are at version 4.6 and now the feature is unplanned. This ticket is now 41 months old and there is still no plan to implement it...

    ADMIN
    Hristian Stefanov
    Posted on: 22 Jun 2023 12:24

    Hi Michael,

    I can confirm that the item was initially scheduled for inclusion in version 4.2. However, due to capacity constraints and the level of prioritization of different items on the roadmap, a re-planning was necessary.

    I am pleased to inform you that the feature is now scheduled to be included in our 4.5 release.

    For more information, keep tracking the item status. Thank you for your patience and understanding for the time being.

    Regards,
    Hristian Stefanov
    Progress Telerik

    As of R2 2023, the default icon type will be SVG instead of Font. See this blogpost for more information.
    Michael
    Posted on: 16 Jun 2023 10:24

    Could you please describe the current status of this ticket? The delivery date is already reached and animations for windows were also on the roadmap for R2 2023?

     

    Thank you.

    Ted
    Posted on: 19 Jul 2022 01:26
    This could use the same animation types as Notifications.
    ADMIN
    Marin Bratanov
    Posted on: 30 Apr 2021 18:58

    Hi Brian,

    You can find something like that in my post from 18 Aug 2020 in this thread.

    Regards,
    Marin Bratanov
    Progress Telerik

    Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

    Brian
    Posted on: 30 Apr 2021 18:53
    Is there a way to make this happen with the animation container? Would love to see an example.