Completed
Last Updated: 12 Sep 2019 13:37 by ADMIN
Release 2.0.0
Peter
Created on: 25 Aug 2019 22:35
Category: Window
Type: Bug Report
0
Maximize button state gets stuck on close while maximized

The window in modal mode, if opened and then maximized, then closed while still maximized, on open again the window is restored to initial unmaxmized state however the button is still in "unmaximize" state so you need to click it twice to maximize again.

 

Setting the state to ImageViewWindow.Maximized = false; before reopening does not do anything with or without StateHasChanged();

2 comments
ADMIN
Stamo Gochev
Posted on: 27 Aug 2019 06:02
Hi,

I can confirm that the described behavior is a bug. Here are the steps that I tried that currently do not work:

1. Maximize a window
2. Close the window
3. Click a button to re-open the window (the button can be rendered at a different place on the page)

There isn't a workaround that I can suggest for now, but if such an approach is found, the item will be updated with this information.
I have also update your Telerik points because of this bug report and your contribution to improving the suite.

Regards,
Stamo Gochev
Progress Telerik UI for Blazor
Peter
Posted on: 25 Aug 2019 22:45
Various failed attempts to get it to do what it should.
<TelerikWindow @ref:suppressField @ref="ImageViewWindow" Modal="true" Height="500px" Width="500px">
    <TelerikWindowActions>
        <TelerikWindowAction Name="Maximize"></TelerikWindowAction>
        <TelerikWindowAction Name="Close"></TelerikWindowAction>
        <TelerikWindowAction Name="ZoomIn" Icon="@Telerik.Blazor.IconName.ZoomIn" OnClick="@ZoomIn"></TelerikWindowAction>
        <TelerikWindowAction Name="ZoomOut" Icon="@Telerik.Blazor.IconName.ZoomOut" OnClick="@ZoomOut"></TelerikWindowAction>
    </TelerikWindowActions>
    <TelerikWindowTitle>
        <strong>Image: @ImageSource.Split("/")[1]</strong>
    </TelerikWindowTitle>
    <TelerikWindowContent>
        <div style="align-content:center">
            <img src="@ImageSource" height="@imageHeight"/>
            @*<img src="@ImageSource" class="@imageClass" />*@        
        </div>
    </TelerikWindowContent>
</TelerikWindow>

@code {


    Telerik.Blazor.Components.Window.TelerikWindow ImageViewWindow;

    public int imageHeight = 400;


    private bool _windowOpen { get; set; } = false;

    private string imageClass { get; set; } = "imageForWindowSmall";

    [CascadingParameter] bool WindowOpen {

        get {
            return _windowOpen;
        }
        set {
            if (value) ShowWindow();
        }
    }
    [CascadingParameter] string ImageSource { get; set; }
    [CascadingParameter] MessageRecord SelectedMessage { get; set; }

    public void ShowWindow()
    {
        ImageViewWindow.Maximized = false; //doesn't work to reset the maxmized button, doesn't do anything actually
        StateHasChanged(); //makes no difference
        ImageViewWindow.Open();
    }


    private void ZoomOut()
    {
        var windowState = ImageViewWindow.Maximized;
        if (imageHeight <= 400) return;
        imageHeight -= 50;        
        StateHasChanged();
        ImageViewWindow.Maximized = windowState; // pointless effort to get it to restore the state of the window, setter does nothing
        StateHasChanged();
    }

    private void ZoomIn()
    {
        var windowState = ImageViewWindow.Maximized;
        if (imageHeight >= 4000) return;
        imageHeight += 50;
        StateHasChanged();
        ImageViewWindow.Maximized = windowState; // pointless effort to get it to restore the state of the window, setter does nothing
        StateHasChanged();
    }