ListItem Element

Defines the property or script whose value is displayed in a row of the list view.

Schema

  • Configuration Element
  • ViewDefinitions Element
  • View Element
  • ListControl Element
  • ListEntries Element
  • ListEntry Element
  • ListItems Element
  • ListItem Element

Syntax

<ListItem>
  <PropertyName>PropertyToDisplay</PropertyName>
  <ScriptBlock>ScriptToExecute</ScriptBlock>
  <Label>LabelToDisplay</Label>
  <FormatString>FormatPattern</FormatString>
  <ItemSelectionCondition>...</ItemSelectionCondition>
</ListItem>

Attributes and Elements

The following sections describe the attributes, child elements, and parent element of the ListItem element. Only one property or script can be specified.

Attributes

None

Child Elements

Element Description
FormatString Element for ListItem for ListControl Optional element.

Specifies a format string that defines how the property or script value is displayed.
ItemSelectionCondition Element for ListItem for ListControl Optional element.

Defines the condition that must exist for this list item to be used.
Label Element for ListItem for ListControl Optional element

Specifies the label that is displayed to the left of the property or script value in the row.
PropertyName Element for ListItem for ListControl Optional element.

Specifies the .NET property whose value is displayed in the row.
ScriptBlock Element for ListItem for ListControl Optional element.

Specifies the script whose value is displayed in the row.

Parent Elements

Element Description
ListItems Element for List Control Defines the properties and scripts whose values are displayed in the list view.

Remarks

For more information about the components of a list view, see Creating a List View.

Example

This example shows the XML elements that define three rows of the list view. The first two rows display the value of a .NET property, and the last row displays a value generated by a script.

<ListEntry>
    <ListItems>
      <ListItem>
        <Label>Property1: </Label>
        <PropertyName>DotNetProperty1</PropertyName>
      </ListItem>
      <ListItem>
        <PropertyName>DotNetProperty2</PropertyName>
      </ListItem>
      <ListItem>
        <ScriptBlock>$_.ProcessName + ":" $_.Id</ScriptBlock>
      </ListItem>
    </ListItems>
</ListEntry>

See Also

ListItems Element

FormatString Element for ListItem

Label Element for ListItem

PropertyName Element for ListItem

ScriptBlock Element for ListItem

Creating a List View

Writing a Windows PowerShell Formatting and Types File