Xceed Grid for WinForms v4.3 Documentation
FormatProvider Property (Cell)
Example 


Xceed.Grid.v4.3 Assembly > Xceed.Grid Namespace > Cell Class : FormatProvider Property
Gets or sets the custom Format Provider that will be used to format the cell's data.
Syntax
'Declaration
 
<BrowsableAttribute(False)>

<DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)>

Public Property FormatProvider As IFormatProvider
'Usage
 
Dim instance As Cell

Dim value As IFormatProvider

 

instance.FormatProvider = value

 

value = instance.FormatProvider
[Browsable(false)]

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

public IFormatProvider FormatProvider {get; set;}

Property Value

A reference to a class that implements the System.IFormatProvider interface.
Remarks

The list of values that can be passed to the FormatSpecifier property can be found in the "Format Specifiers and Format Providers" topic of the .NET Framework.

If the IsFormatProviderAmbient property returns true, then the value of the FormatProvider property is inherited from its parent.

To reset the value of the FormatProvider property to its default value, DefaultFormatProvider, the ResetFormatProvider method must be called.

Example
The first example modifies the System.Globalization.DateTimeFormatInfo.DateSeparator property of an instance of a System.Globalization.DateTimeFormatInfo object and then assigns the DateTimeFormatInfo object to the FormatProvider property. The second example, modifies the DateTimeFormatInfo object in the same manner but also specifies the format of the cell to display the contents in "short date" format:
' FormatProvider Dim dtfi As New System.Globalization.DateTimeFormatInfo dtfi() dtfi.DateSeparator ="/" gridControl1.DataRowTemplate.Cells( "Date1" ).FormatProvider = dtfi ' FormatProvider AND FormatSpecifier gridControl1.DataRowTemplate.Cells( "Date2" ).FormatProvider = dtfi gridControl1.DataRowTemplate.Cells( "Date2" ).FormatSpecifier = "d"
// FormatProvider System.Globalization.DateTimeFormatInfo dtfi = new System.Globalization.DateTimeFormatInfo(); dtfi.DateSeparator = "/"; gridControl1.DataRowTemplate.Cells[ "Date1" ].FormatProvider = dtfi; // FormatProvider AND FormatSpecifier gridControl1.DataRowTemplate.Cells[ "Date2" ].FormatProvider = dtfi; gridControl1.DataRowTemplate.Cells[ "Date2" ].FormatSpecifier = "d";
Requirements

Target Platforms: 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

See Also

Reference

Cell Class
Cell Members
ResetFormatProvider Method
DefaultFormatProvider Property