Printer Friendly Version      Send     
Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Silverlight
ItemsControl Class
Other versions are also available for the following:
.NET Framework Class Library for Silverlight
ItemsControl Class
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Represents a control that can be used to present a collection of items.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

Visual Basic (Declaration)
<ContentPropertyAttribute("Items", True)> _
Public Class ItemsControl _
    Inherits Control
Visual Basic (Usage)
Dim instance As ItemsControl
C#
[ContentPropertyAttribute("Items", true)]
public class ItemsControl : Control
Visual C++
[ContentPropertyAttribute(L"Items", true)]
public ref class ItemsControl : public Control
JScript
public class ItemsControl extends Control
XAML Object Element Usage
<ItemsControl ...>
  oneOrMoreItems
</ItemsControl>
XAML Values
oneOrMoreItems

One or more object elements for classes that derive from FrameworkElement. These elements become items in the Items collection.

In general, an ItemsControl serves two roles. It can be used to present a fixed set of items, or it can be used to display a list obtained from data binding to an object.

If you want to display a fixed list, populate Items with one or more FrameworkElement child objects, and leave DisplayMemberPath as the default empty string. Do not specify ItemsSource.

If you want to display data from an object source, specify ItemsSource to be a reference to an object. Usually this is done through a Binding declaration, and the resolution mechanism for the object being used as the binding source is potentially influenced by the acting DataContext. You can set DisplayMemberPath to be the name or path of the particular property that should display as repeating data using a default display for the returned object. Or you can leave DisplayMemberPath as the default empty string, and specify a DataTemplate for ItemTemplate. This latter approach gives you more precise control of the visual representation of each item, and also enables you to display multiple properties of each data bound object within each item, using a layout that you define in the template.

System..::.Object
  System.Windows..::.DependencyObject
    System.Windows..::.UIElement
      System.Windows..::.FrameworkElement
        System.Windows.Controls..::.Control
          System.Windows.Controls..::.ItemsControl
            System.Windows.Controls..::.ListBox
            System.Windows.Controls..::.TabControl
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker