WPF Revision Questions: Application and Window Basics


This is the first in a  set of revision questions for WPF.  This is modeled as a kind of  Exercise section  for  Petzold’s “Application = Code + Markup” in that you’ll find answers or clues to the answers in the book. Without more ado here we go:

Application Object

  • What is meant by [STAThread] attribute?
  • Name any three of the events of the Application object.(Hint: Startup,…
  • What is shutdownmode? Name some of the values it can take (the names need not be precise) (Hint: OnMainWindowClose,…
  • There can be only one Application object in a program. What static property can be used to access it? (Answer:Current)
  • What is the parent class of an  Application object?
  • **Can an Application object contain (unattached) dependency objects?

Window Object

  • What is the resolution of a WPF window? If you set Height=960 what is the height of the window in inches?
  • How would you position a window to occupy the top left corner of the screen window?  (Hint: use SystemParameters)
  • How would you trap a key down or key up event in a window?
  • How would you handle text input, from a keyboard,  in a window?
  • How would you set the title of a window?
  • What are some of border styles?
  • What is the type of Window.Background? (hint: it is not color)
  • What is WindowState? (Hint: WindowState.Maximized…)

About The Sunday Programmer

Joe is an experienced C++/C# developer on Windows. Currently looking out for an opening in C/C++ on Windows or Linux.
This entry was posted in .NET, WPF and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s