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();
<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();
}