Back to Devexpress

DXCollectionView.DisplayFormat Property

maui-devexpress-dot-maui-dot-collectionview-dot-dxcollectionview-268ed80b.md

latest3.2 KB
Original Source

DXCollectionView.DisplayFormat Property

Gets or sets the pattern used to format list items. This is a bindable property.

Namespace : DevExpress.Maui.CollectionView

Assembly : DevExpress.Maui.CollectionView.dll

NuGet Package : DevExpress.Maui.CollectionView

Declaration

csharp
public string DisplayFormat { get; set; }

Property Value

TypeDescription
String

The pattern used to format the CollectionView’s items.

|

Remarks

Use the DisplayFormat property to format the CollectionView item’s display value and add additional text. The pattern should have the following structure:

<custom static text>{0:<format specifier<precision specifier>>}<custom static text>

  • {0} – The CollectionView item value’s placeholder. The CollectionView obtains item values from DisplayMember.
  • format specifier – The format type (currency, scientific, and so on).
  • precision specifier – The number of characters displayed after the decimal point.

For example, set the DisplayFormat property to Price: {0:c2} to display currency values. If the summary value is 123 , its formatted equivalent is Price: $123.00.

Refer to the following pages for more information about format specifiers:

The following example formats a CollectionView’s items:

xaml
<dxcv:DXCollectionView ItemsSource="{Binding Data}"
                       DisplayMember="Name"
                       DisplayFormat="Contact: {0}">
</dxcv:DXCollectionView>

In XAML, insert empty brackets into the beginning of a format string if it starts with a placeholder. Refer to the following page for more information: {} Escape sequence / markup extension.

You can also define the DXCollectionView.ItemTemplate property to format and customize the CollectionView item’s content.

See Also

DXCollectionView Class

DXCollectionView Members

DevExpress.Maui.CollectionView Namespace