Build applications at a higher level of abstraction. This set of interrelated patterns solves common UI application design problems in a way that keeps both developers and designers happy. Build applications faster, and make them more maintainable, on any XAML stack.
Mathematician and software developer, Michael L Perry applies formal proof to creating reliable software. He has developed a method starting from the works of the greats (Meyer, Rumbaugh, Knuth), and embodied it in his open-source frameworks (Update Controls and Correspondence).
Blend Techniques Welcome back to XAML Patterns. This is Michael L. Perry. Before we get started with the patterns themselves, I want to go over a few Blend techniques. A lot of developers that I talk to are not comfortable editing their XAML in Blend. They usually use Visual Studio for that, but I'm here to tell you that there's an awful lot of productivity that you can gain by using Blend. You'll see me using Blend an awful lot throughout these patterns, so let me show you some of the high-level techniques that I use while I'm using Blend. Expression Blend has become Blend for Visual Studio. It is now included with Visual Studio 2012. So, if you've already got Visual Studio 2012, when you installed it, you had the option of also installing Blend. I would encourage you if you haven't installed Blend to go and rerun that installer and check that box. You're going to want this tool. Then make sure that you also apply Update 2 to Visual Studio 2012. Update 2 brings in a lot of support for Blend for WPF and Silverlight. If you don't already have Visual Studio, the best place to get it is dev. windows. com. Just click on get started, and you'll be taken directly to a place where you can download Visual Studio with Blend. Get that installed, and then come back here, and let's run through some of these Blend techniques.
View Model Patterns Welcome back to XAML Patterns. I'm Michael L. Perry, and in this module we'll be diving into the rich family of View Model Patterns. In 2004, Martin Fowler published an article describing the Presentation Model pattern. This was a separation pattern in the spirit of Model View Controller and Model View Presenter. The purpose of this pattern was to remove state and behavior from the view so that you can more easily test your business logic and so that your business logic is not so dependent upon changes to the view. In 2005, John Gossman published the Model View ViewModel pattern. This is a specialization of the Presentation Model pattern specifically for XAML data binding frameworks. At the time, the industry was just discovering how much powerful WPF data binding was over its predecessor Windows Forms. You see, in WPF it was possible to data bind to a plain old CLR object, not just to a data base table. This opened the door to a new way of designing rich client user interfaces. As MVVM evolved, we came to discover that it was not just one pattern, but a whole family of patterns. We formed several different opinions based on the constraints of the problem, opinions about how view models should respond to events, how view models should communicate with one another, and how view models should be paired with their views. In this module, we're going to cover some of these patterns. Throughout the discussion our goals will remain the same as Martin Fowler's original goals for the Presentation Model pattern, that is to make code more isolated so that it is more testable and more resilient to change.
Behavioral Patterns Welcome back to XAML Patterns. In this module, we're going to be talking about Behavioral Patterns. When we're programming in XAML we wear two hats. Sometimes we're coders, and sometimes we're designers. On rare occasions these two roles are played by two different people, but more often it's just us switching from one hat to the other. Whether we're playing the role of coder or designer at any given moment, we have to make decisions. To make those decisions at the best possible moment requires two things. We need separation and freedom. That's the separation of a component's behavior from its presentation and the freedom to specify behaviors at design time. The behavioral patterns will help us to achieve both of these goals. To achieve separation we'll study three variations of the command pattern. The variation you choose will be based on the type of view model you use because commands are all about joining the view's behavior to the view model's controls. So, if you're using a stateful view model you'll want to choose a relay command, for a stateless view model choose a dependent command, and for a reactive view model choose a reactive command. And then to achieve freedom, we're going to study the variations of behaviors. There are four variations of behaviors that give the designer the freedom to control component behavior at design time. These are attached behaviors, Blend behaviors, trigger actions, and targeted trigger actions. So, let's see how these patterns will give us separation and freedom.
Animation Patterns Welcome back to XAML Patterns. I'm Michael L Perry, and now we're going to be talking about animation patterns. For this, I want a little bit of audience interaction, here. I want you to put your right thumb on your right shoulder, and your left thumb on your left shoulder. Point your fingers up into the sky, and now, put your hands back on the mouse and keyboard, and when I count to three, go quickly back to that position. Are you ready? One, two, three. That's what most users do when an application changes suddenly. They're surprised by the unexpected change. They don't know what changed, and they don't know what they did to cause the change. All they know is they don't want that to happen again. Contrary to popular opinion, the purpose of animation is not to call attention to the component. Quite the opposite. Animation should be used to make digital objects seem like real objects. If applied correctly, the user won't even notice. But if an object draws attention to itself, then the animation is incorrect. For a really good discussion on the effective use of animations, please see Billy Hollis' course on Creating User Experiences: Fundamental Design Principles. While we're creating effective animations, we want to make sure that we retain the developer designer separation that we worked so hard to gain. To that end, we'll be using the visual state manager, triggers, and theme transitions. With the visual state manager, we'll explore three patterns. Visual state binding, circular animations, and control states. With triggers, we're going to build list item animations. And then we're just going to look at theme transitions all by themselves.