Prism Problems & Solutions: Mastering TabControl

This course will focus on using the TabControl as a Prism region. We will identify and solve common issues such as closing tab items, removing items from the region, child navigation, and scoped regions with navigation.
Course info
Rating
(92)
Level
Advanced
Updated
Aug 12, 2015
Duration
1h 57m
Table of contents
Course Introduction
Using the TabControl
Closing Tab Items
Child Navigation
Description
Course info
Rating
(92)
Level
Advanced
Updated
Aug 12, 2015
Duration
1h 57m
Description

This course will focus on using the TabControl as a Prism region. We will identify and solve common issues such as data binding to the TabItem header as well as how to control how TabItems are created. We will see how to extend the functionality of a TabItem without inheritance or custom controls to support being closed from a UI button located in the TabItem header. This course will also show advanced navigation scenarios when using the TabControl as a region by extending Prism to add support for scoped regions in the navigation framework.

About the author
About the author

Brian Lagunas is a Microsoft MVP, a Microsoft Patterns & Practices Champion, Director of Technology for INETA, co-leader of the Boise .Net Developers User Group (NETDUG), board member of Boise Code Camp, speaker, trainer, author, and original creator of the Extended WPF Toolkit.

More from the author
More courses by Brian Lagunas
Section Introduction Transcripts
Section Introduction Transcripts

Course Introduction
You are watching this course because you are a Prism developer. You write composite WPF line of business applications using the Prism library. You could be a beginner who just started learning Prism, maybe you've done some tutorials, you've watched some of my previous courses, or you could be an experienced developer, someone who's just been using Prism for a very long time. Whatever the case is for you, chances are you've hit some roadblocks. You've run into some problems writing your production applications using Prism. Hello, this is Brian Lagunas, and welcome to my course Prism Problems and Solutions: Mastering the TabControl. This is the second course in a series of courses in which we take a problem/solution approach to Prism application development. If you're new to this series, let's take a moment to discuss how each of the courses in this series in laid out. Each course will start by identifying one or more problems. In order to demonstrate the problem, we will either see a sample or write the code necessary to reproduce the problem we are currently focused on. Each problem will then have a corresponding solution. After we have identified the problem and reproduced the problem, we will then discuss possible solutions. We will then write the code required to implement a solution for the corresponding problem. By the end of the course, you should have all the information you need to implement all of the solutions that we've covered into your production applications.

Using the TabControl
So you want to master the TabControl. Well, before you can master something, you kind of have to understand the basics. So in this module, that's what we're going to do, we'll concentrate on the basics. We're going to learn how we can inject views into the TabControl, we want to learn how we can set the header text of the TabConrol, maybe data bind that to the view model itself, and we also want to kind of understand how we can control tabbed instances, there's different scenarios there where maybe I want to open the same instance of a tab, or maybe I want to open multiple instances of a tab, how do we control that? So let's go ahead and jump right into it.

Closing Tab Items
In the previous module, you learned all the basics about getting started using the TabControl as a region in a Prism application. It was some pretty basic stuff. Well in this module, we're going to kick it up a notch. We're going to make things just a little more complicated because we have to learn how to close TabItems, so all those great tabs we were creating on the fly using Prism Navigation, well we have to be able to remove those TabItems now. And there's actually more problems that have to be solved than you may think in order to achieve closing a TabItem. I mean obviously we have to learn how to add a close button to a TabItem, well that's an easy one, but how do we remove the TabItem when we click on that button? And besides that, how do we remove the associated view from the Prism region that was injected when the TabItem was created? Now to make things even more complicated, how do we prevent a TabItem _____from being closed from when in the ViewModel, and let's say that it is allowed to be closed, how do we let the ViewModel know that it's being closed? I mean as you can see, the complexity kind of builds on top of itself. And in this module, we're going to take the time to answer all of those questions. At the end of this module, you're going to know just about everything you need to know in order to implement closing TabItems in your Prism application, so let's go ahead and get started.