Xceed Grid for WinForms v4.3 Documentation
Welcome to Xceed Grid for WinForms v4.3 / Basic Concepts / CellEditorManagers and CellViewerManagers / How to use cell viewers / NumericViewer

In This Topic
    NumericViewer
    In This Topic

    The NumericViewer can be used to view the content of cells which have a numeric datatype. 

    Using the NumericViewer

    By default, the NumericViewer will be created as the CellViewerManager for all columns in the grid which have a numeric datatype. 

    The value displayed by the NumericViewer can be retrieved via the GetText method. The value will be returned as a string and formatted according to the cell's FormatProvider and FormatSpecifier properties. 

    If a CellViewerManager other than the NumericViewer is desired by default for columns which have a numeric datatype, the GridControl's CellViewerManagerMapping property can be modified. For example:

    VB.NET Copy Code
    GridControl1.CellViewerManagerMapping( GetType( Integer ) ) = New CustomNumericViewer()
    C# Copy Code
    GridControl1.CellViewerManagerMapping( GetType( Integer ) ) = New CustomNumericViewer()

    If a different CellViewerManager is required for only one column or cell, the CellViewerManager property of the specific column or cell can be set rather than changing the default CellViewerManager that is created for all numeric columns via the CellViewerManagerMapping property.

    VB.NET Copy Code
    GridControl1.Columns( "Freight" ).CellViewerManager = New CustomNumericViewer()
    C# Copy Code
    gridControl1.Columns[ "Freight" ].CellViewerManager = new CustomNumericViewer();

    Underlying control

    The underlying control wrapped by the NumericViewer is the WinNumericTextBox control and is accessible through the Control property. All settings relating to the underlying control must be accessed via the Control property. 

    More information regarding the WinNumericTextBox control can be found in the WinNumericTextBox control topic.