Minimizing and Maximizing
The Window title bar provides commands to minimize it, maximize it to the viewport, or restore its default size. The state property reflects the current view and accepts default, minimized, or maximized.
Persisting the State
To set the initial state and keep it in sync with the title bar actions, control the Window by:
- Setting the
stateproperty. - Updating the value in the
stateChangeevent handler, or by using two-way binding.
If you close and reopen the Window while the parent retains that value, the Window reopens in the last state.
The following example keeps the state in the parent component and changes it from the title bar and from external buttons.
Keeping the Content
By default, the Window removes its content element from the DOM when minimized. Set keepContent to true to hide the content instead and keep it in the DOM. Windows that the WindowService opens with the minimized state also keep their content in the DOM, because the service sets keepContent to true.
The following example keeps the Window content in the DOM while minimized.