Correctly retained state of the dialog.
Specified maximum width and height of the dialog.
Added demo for ListView.