Building a Simple Image Viewer Application

To illustrate the role that Visual Studio plays in WPF application development, let’s build a sample application from scratch. In the tradition of “experience first,” let’s select something that can benefit from WPF’s strong suits—namely, visualizations and robust control layouts and templating.

Consider an image viewer application. We can use this application to view a list of image thumbnails and, after selecting a thumbnail, we can view the image itself and even make changes to it.

We target the rough design shown in Figure 21.23.

Image

FIGURE 21.23 A sketch of an image viewer UI.

Here are our base requirements:

Image When the application loads, it parses the images contained in the specified folder.

Image Every image is listed in a list box; the list box shows image thumbnails and no text.

Image When the user clicks one of the items in the list box, the image viewing area is populated with the selected image.

Image The user can then choose to manipulate the image: a black-and-white effect can be applied, the image can be rotated clockwise or counterclockwise, the image can be flipped, and it can be mirrored.

Image In general, we try to use WPF’s capabilities when possible to make the application more visually compelling; a standard battleship gray application is not what we are looking for here.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset