Setting WindowState to Maximized does not work before ShowDialog for second display
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
**Scenario**
- We want to create instance of our custom window
- show it at second/third screen maximized.
**Problem**
- We create instance of window
- Set location somewhere inside desired display.
- Set `WindowState` to `WindowState.Maximized`.
- It does not work. Window is always maximized on the main display.
So we do not know why setting `WindowState` works only for main display before `ShowDialog` is used but not for other displayes. Setting WindowState when window is already shown works as expected.
See example in attachment.
### Reproduction Steps
See example in attachment.
[WpfApp4.zip](https://github.com/user-attachments/files/17040598/WpfApp4.zip)
### Expected behavior
Setting WindowState to Maximized work for all displayes even if called before ShowDialog
and window is properly maximized on the correct display.
### Actual behavior
Window is always shown on the main display if maximized before shown.
### Regression?
_No response_
### Known Workarounds
- When we use `SourceInitialized` and ste WindowState there to Maximized it will show correctly on the second display.
### Impact
_No response_
### Configuration
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.