Chapter 19. A little UI work: user controls and Blend

 

This chapter covers

  • Creating a shape in Blend
  • Creating and using a UserControl
  • Creating dependency properties
  • Setting view states

In the previous chapter, we created a chat app with the understanding that it would be more game-like in subsequent chapters. The focus was on sockets networking in that chapter, so it made sense not to include graphics and other game functionality. But our app has a giant unused area to the right that’s just begging for us to fill it with something cool.

In this chapter, we’ll flesh out the game a bit more. Maybe “amusement” is a better term, because this game has no actual gameplay, just movement of elements onscreen in a multiplayer context. (Of course, that makes it better than half the games I downloaded to my older Kindle Fire.)

Figure 19.1 shows the app as it will appear at the end of this chapter, complete with three copies of the little Asteroids-inspired ship.

Figure 19.1. The app showing the existing chat area, plus the playing field containing three ships. The ships are hardcoded in XAML for the moment but are implemented as user controls.

19.1. Updated game UI

19.2. Designing the ship UI

19.3. Building out the ship user control properties

19.4. Summary