c# - WPF form should resize to show its content -


when wpf window appear first time, content seem frozen. refresh content need resize form, fixed. or hit tab find listbox -it's not visible- , click , viola! form updates content again.

what think? weird huh? in advance!

enter image description here

edit:

private void window_loaded(object sender, routedeventargs e) {    this.show();     while (!appmain.needclose)    {       system.windows.forms.application.doevents();       dothings();    } } 

resizing window force internals invalidate , re-paint. try invalidating form when it's loaded force same:

private void window_loaded(object sender, routedeventargs e) {    this.show();     this.invalidate();     while (!appmain.needclose)    {       system.windows.forms.application.doevents();       dothings();    } } 

unless you're doing sort of custom message pumping though, standard forms message pump should while loop you. might find because you're intercepting window loaded event you're stopping initialisation completing.

calling doevents bad code smell in experience. if need periodically, it's better trigger timer of sort.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -