The WPF ListBox: the items it contains.

A ListBox is a visual container for ListBoxItems. A ListBoxItem is a control (it inherits directly from System.Windows.ContentControl and indirectly from System.Windows.Control. Since every System.Windows.Control has a Template property of type ControlTemplate, we can control the visual appearance of a ListBoxItem by setting the ControlTemplate in XAML.

The ControlTemplate for a ListBoxItem provides a border around the content of the control – the border is actually a FILLED rectangle and is set to transparent if the item is not selected or does not have the mouse over it. It is set to the default filled colour for selection if it is selected.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: