You can use hundreds of controls with WPF For a better understanding, the controls are categorized into these groups:
- Simple controls
- Content controls
- Headered content controls
- Items controls
- Headered items controls
Simple controls are controls that don’t have a Content property, With the But ton class, you have seen that the Button can contain any shape, or any element you like. This is not possible with simple controls, The following table shows simple controls and their functionality.
Although simple controls do not have a Content property, you can completely customize the look of the control by defining a template.
A ContentControl has a Content property, with which you can add any content to the control, The Button class derives from the base class ContentControl, so you can add any content to this control.
In a previous example, you saw a Canvas control within the Button: Content controls are described in the following table.
Only a Frame control is contained within the window of the following XAML code, The Source property is set to http://www.csharpaid.com. so the Frame control navigates to this Web site, as you can see in Figure 34-10.
Title=”Frame Sample” Height=400 Width=400>
<Frame Source=.http://www.csharpaid.com. I>
Headered Content Control
Content controls with a header are derived from the base class HeaderedContentControl, which itself is derived from the base class ContentControl, The class HeaderedContentControl has a property Header to define the content of the header and HeaderTemplate for complete customization of the header, The controls that are derived from the base class HeaderedContentControl are listed in the following table.
A simple use of the Expander control is shown in the next example, The Expander control has the property Header set to Click. for more, This text is displayed fo!,expansion. The content of this control is shown only if the control is expanded, Figure 34-11 shows the sample application with a collapsed Expande control, Figure 34-12 shows the same application with an expanded Expander control.
To make the header text of the Expander control change when the control is expanded, you can create a trigger.
The class ItemsControl contains a list of items that can be accessed with the Items property, Classes that are derived from ItemsControl are shown in the following table.
Headered Items Controls
HeaderedItemsControl is the base class of controls that include items but also has a header The class HeaderedItemsControl is derived from ItemsControl.
Classes that are derived from HeaderedItemsControl are listed in the following table.