This article is a mirror article of machine translation, please click here to jump to the original article.

View: 18482|Reply: 0

[WPF] What is the difference between the Window.Loaded and Window.ContentRendered events?

[Copy link]
Posted on 12/22/2017 9:57:20 PM | | |

What is the difference between Window.Loaded and Window.ContentRendered events in WPF? Is the first ContentRendered event called?

The description of the Window.ContentRendered event here is just an illustration

This happens after the contents of the window are rendered.
The Window.Loaded event here is described below

Occurs when elements are laid out, rendered, and prepared for interaction.
I have a case where I want to set the MaxHeight of the window to the height of the screen work area that shows my window. In which event should I do that?

Edit:

I think I found what I wanted, but now I'm even more confused. The Loaded event occurs first, followed by the ContentRendered event. & is &,, which indicates that the Loaded event is

Raised before the window is displayed
contentrendered'event is

Triggered when the contents of the window are visually rendered.
This conflicts with the MSDN documentation's description of the Loaded event:

Occurs when elements are laid out, rendered, and prepared for interaction.




Previous:The WPF TextBox control implements vertical centering of Chinese characters
Next:WPF CefSharp generates several errors
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com