Programming Overview Flashcards

Chapter 2

1
Q

How to create WPF application without XAML?

A
  1. Using Visual Studio, create a new project of type Console Application (not WPF
    Application)
  2. In the Solution Explorer, open the Properties window, and change Output Type to
    Windows Application.
  3. In the Solution Explorer, under References, look at the .NET tab, and add
    references to the following assemblies:
    − PresentationCore
    − PresentationFramework
    − WindowsBase
  4. In the Program.cs file, do the following:
    a. Add the [STAThread] attribute before the Main method declaration.
    b. Add a using statement for System.Windows.
    c. Create Window object
    d. Create Application object
    e. Use Run Method of the Application and pass it the Window object to run the program.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Application and Window class relatshionship

A

Most minimally functional WPF programs contain an instance of the Application class and one or more instances of the Window class.

You can think of a WPF program as a single Application object and one or more Window objects:

  • The Application object supports and hosts the Window objects.
  • The Window objects comprise the user interface and present the data.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The Window Class

A

Every window on the screen is the visual representation of an instance of the Window class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly