Export (0) Print
Expand All

How to: Display Item Headers in a DataRepeater Control

Visual Studio 2005

The item header in a DataRepeater control provides a visual indicator when a DataRepeaterItem is selected. When the LayoutStyle property is set to Vertical (the default), the item header is displayed to the left of each item. When the LayoutStyle property is set to Horizontal, the item header is displayed at the top of each item.

When it is first selected, the item header is displayed in the color that is specified by the SelectionColor property, and a white arrow icon is displayed.

Note:

If you set the SelectionColor to White, the selection symbol will not be visible when the item is first selected.

When a field in the DataRepeaterItem has focus, the color of the item header changes to the ItemTemplate background color and the arrow icon changes to black. If data is changed, a pencil symbol is displayed in the item header.

The default width (or height when the LayoutStyle property is set to Vertical) of the item header is 15 pixels. You can change the width by setting the ItemHeaderSize property.

Note:

If the ItemHeaderSize property is set to a value that is less than 11, the indicator symbols in the item header will not be displayed.

You can hide the item headers by setting the ItemHeaderVisible property to False. When ItemHeaderVisible is set to False, the only indication that an item is selected is a dotted line around the perimeter of the DataRepeaterItem.

Note:

You can also provide your own selection indicator by monitoring the IsCurrent property of the DataRepeaterItem in the DrawItem event of the DataRepeater control. For more information, see IsCurrent.

To change the appearance of item headers

  1. In the Windows Forms Designer, select the lower region of the DataRepeater control.

    Note:

    You must select the lower region of the control. If you select the item template section, a different set of properties will appear in the Properties window.

  2. In the Properties window, use the SelectionColor property to change the color of the item headers.

    Note:

    If you set the SelectionColor to White, the selection symbol will not be visible when the item is first selected.

  3. Use the ItemHeaderSize property to change the width (or height) of the item headers.

    Note:

    If the ItemHeaderSize property is set to a value that is less than 11, the indicator symbols in the item header will not be displayed.

To hide item headers

  1. In the Windows Forms Designer, select the lower region of the DataRepeater control.

    Note:

    You must select the lower region of the control. If you select the item template section, a different set of properties will appear in the Properties window.

  2. In the Properties window, set the ItemHeaderVisible property to False.

    When an item in the DataRepeater is selected, the only indication will be a dotted line around the perimeter of the DataRepeaterItem.

Community Additions

ADD
Show:
© 2015 Microsoft