Export (0) Print
Expand All

ItemsControl.ItemStringFormat Property

Gets or sets a composite string that specifies how to format the items in the ItemsControl if they are displayed as strings.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

[BindableAttribute(true)]
public string ItemStringFormat { get; set; }
<object ItemStringFormat="string" .../>

Property Value

Type: System.String
A composite string that specifies how to format the items in the ItemsControl if they are displayed as strings.

ItemStringFormat can be a predefined, composite, or custom string format. For more information about string formats, see Formatting Types. If you set the ItemTemplate or ItemTemplateSelector of a ItemsControl, the ItemStringFormat property is ignored.

The following example uses the ItemStringFormat to specify the format of a list of DateTime objects.


<ListBox xmlns:sys="clr-namespace:System;assembly=mscorlib"
         ItemStringFormat="MMMM d, yyyy">
  <sys:DateTime>2004/3/4</sys:DateTime>
  <sys:DateTime>2004/8/9</sys:DateTime>
  <sys:DateTime>2005/10/14</sys:DateTime>
  <sys:DateTime>2005/4/8</sys:DateTime>
</ListBox>

  <!--The results when the default culture is en-US:
      March 4, 2004
      August 9, 2004
      October 14, 2005,
      April 8, 2005-->


.NET Framework

Supported in: 4, 3.5 SP1, 3.0 SP2

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft