Home > Sample chapters

MCTS Self-Paced Training: Styles and Animation in Windows Presentation Foundation

Case Scenarios

In the following case scenarios, you apply what you’ve learned about how to use controls to design user interfaces. You can find answers to these questions in the “Answers” section at the end of this book.

Case Scenario 1: Cup Fever

You’ve had a little free time around the office, and you decided to write a simple but snazzy application to organize and display results from World Cup soccer matches. The technical details are all complete: You’ve located a Web service that feeds up-to-date scores, and you’ve created a database that automatically applies updates from this service for match results and keeps track of upcoming matches. The database is exposed through a custom data object built on ObservableCollection<> lists. All that remains are the finishing touches. Specifically, when users choose an upcoming match from a drop-down box at the top of the window, you want the window’s color scheme to match the colors of the teams in the selected matchup.

Technical Requirements

  • The user interface is divided into two sections, each of which is built on a Grid container. Each section represents a team in the current or upcoming match. The user interface for each section must apply the appropriate team colors automatically when a new match is chosen.

Question

Answer the following question for all your office mates, who are eagerly awaiting the application’s completion.

  • How can you implement these color changes to the user interface?

Case Scenario 2: A Far-Out User Interface

Our friends with the questionable taste are back. They were so impressed with the work you did for them back in Chapter 4 that they’ve asked you to design a user interface that further pushes the envelope of good design sensibilities. Rather than having a static tie-dyed appearance, now they want the background to be a constantly changing multicolored experience. The idea of using a RadialGradientBrush to paint the background of the window is still acceptable, but they want the center of the gradient to change over time and they want the colors of the background to change.

Question

Answer the following question for your manager:

  • How can we implement this appearance?