15.02.2015 Views

C# 4 and .NET 4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

WPF ❘ ChaPTer 35 cOre wpf<br />

(continued)<br />

ConTenTConTrol ConTrols<br />

UserControl<br />

Window<br />

NavigationWindow<br />

desCriPTion<br />

Using the class UserControl as a base class provides a simple way to<br />

create custom controls. However, the UserControl base class does not<br />

support templates.<br />

The Window class allows you to create windows <strong>and</strong> dialog boxes.<br />

With the Window class, you get a frame with minimize/maximize/close<br />

buttons <strong>and</strong> a system menu. When showing a dialog box, you can use the<br />

ShowDialog()method; the Show() method opens a window.<br />

The NavigationWindow class derives from the Window class <strong>and</strong> supports<br />

content navigation.<br />

Only a Frame control is contained within the Window of the following XAML code. The Source property<br />

is set to http://www.thinktecture.com, so the Frame control navigates to this web site, as you can see in<br />

Figure 35-9.<br />

<br />

<br />

<br />

code snippet FrameDemo/MainWindow.xaml<br />

figure 35-9<br />

headered Content Controls<br />

Content controls with a header are derived from the base class HeaderedContentControl, which itself is<br />

derived from the base class ContentControl. The HeaderedContentControl class has a property Header<br />

to define the content of the header <strong>and</strong> HeaderTemplate for complete customization of the header. The<br />

controls that are derived from the base class HeaderedContentControl are listed in the following table.<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!