Xceed Grid for WinForms v4.3 Documentation
Xceed.Grid.v4.3 Assembly / Xceed.Grid Namespace / Column Class / FormatProvider Property
Example


In This Topic
    FormatProvider Property (Column)
    In This Topic
    Gets or sets the custom Format Provider that will be used to format the data in the column's cells.
    Syntax
    'Declaration
     
    <BrowsableAttribute(False)>
    <DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)>
    Public Property FormatProvider As IFormatProvider
    'Usage
     
    Dim instance As Column
    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.

    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 column to display the contents of the cell in "short date" format:
    ' FormatProvider
    
    Dim dtfi As New System.Globalization.DateTimeFormatInfo dtfi()
    dtfi.DateSeparator ="/"
     
    grid.Columns( "Date1" ).FormatProvider = dtfi
    
    ' FormatProvider AND FormatSpecifier
    
    grid.Columns( "Date2" ).FormatProvider = dtfi
    grid.Columns( "Date2" ).FormatSpecifier = "d"
    // FormatProvider
    
    System.Globalization.DateTimeFormatInfo dtfi = new System.Globalization.DateTimeFormatInfo();
    dtfi.DateSeparator = "/";
    grid.Columns[ "Date1" ].FormatProvider = dtfi;
    
    // FormatProvider AND FormatSpecifier
    
    grid.Columns[ "Date2" ].FormatProvider = dtfi;
    grid.Columns[ "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